'How do I list the data using mongoose?
Recently I have a problem with mongoose. I wanted to get the data of a guild (discord) and list it in my message. But idk how to get the data from mongodb in typescript. (Note: There is some data is optional so sometimes got some data added or is null like role, msg_num etc)

Solution 1:[1]
Do you have an interface for your guild schema? If you do, you should probably try using mongoose queries and construct a Collection<string, GuildSchema> (string - guild ID, GuildSchema - your guild schema's interface).
You can look through this documentation of mongoose queries, which contains a lot of examples. I suggest you using the Model.find() method,which returns a list of objects.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DeMineArchiver |
