I want to be able to turn a Mongoose Collection into a normal array. I have heard there is a method .toArray(). I have tried calling this on the Mongoose Collection directly and on Model.find({}).toArray(function(err, docs) {}); Both seem to throw error 'has no method toArray()'.What am I doing wrong?
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
toArray() is a method of the drivers Cursor class. If I understand the question you can retrieve all docs in a collection byYourModel.find({}, function (err, docs) {// docs is an array of all docs in collection});
I want to be able to turn a Mongoose Collection into a normal array. I have heard there is a method .toArray(). I have tried calling this on the Mongoose Collection directly and on Model.find({}).toArray(function(err, docs) {}); Both seem to throw error 'has no method toArray()'.What am I doing wrong?--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to