S
S
Seque2022-03-07 11:10:53
MongoDB
Seque, 2022-03-07 11:10:53

How to get data from db to discord?

Hello.
Data output from the database to the discord on command.

const dbj = mongoclient.db("Data"); 
    const col = dbj.collection("violats"); //раздел 
    const my = col.find({});

I want to get all the available data, but for some unknown reason this cannot be done. There are only 3 records, but here is an example of one:
_id:"342658950673596418"
__v: 0
count: 1

I was advised to convert the object using JSON.stringify(), but the result was unsuccessful:
await message.reply(JSON.stringify(my));
//error:
{"_events":{},"_eventsCount":0}


I do not understand what the problem is.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2022-03-07
@Seque

my.toArray()
https://docs.mongodb.com/manual/reference/method/c...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question