To find objects with array of ids we can do this:
var idsArray = ['id1', 'id2', 'id3'];
SomeObject.find({'chatroomId': { $in: idsArray}}).exec();
.then(function(someObjects) {
console.log(someObjects);
})
Is it possible to limit result for each member in array? Not for whole result like this:
SomeObject.find({'chatroomId': { $in: idsArray}}).limit(3)
but for each element. Maybe something like this:
SomeObject.find({'chatroomId': { $in: idsArray.forEach.limit(3)}});
via Eugene G.
No comments:
Post a Comment