K
K
Keksonov2017-08-24 22:01:39
MongoDB
Keksonov, 2017-08-24 22:01:39

How to get the entire monogoose collection?

There are 2 different models that are in the same collection. How to get the whole collection? I usually get [modelName].find(), but that's not how it works here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Ptolemy_master, 2017-08-25
@Keksonov

Coder321 : It won't work because the query will only return records related to a certain model, and the topicstarter needs everything.
You can try as described here https://stackoverflow.com/questions/21429630/query...

MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
if(err) { return console.dir(err); }
var collection = db.collection('kittens');
collection .find().toArray(function(err, kittens) {
// here ...
});
});

True, this is not Mongoose

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question