How to write the mongoose functions given mongodb query? How to write the mongoose functions given mongodb query? mongoose mongoose

How to write the mongoose functions given mongodb query?


Model.find is an asynchronous operation which needs to be awaited / continued by using .then() or passing callback:

const items = await Room.find(filter);


Try this code it should work

const filter = [  { users: new mongodb.ObjectID(uid1) },  { users: new mongodb.ObjectID(uid2) }]const items = Room.find({ $and: filter });