Answers for "findbyname mongoose"

Go
4

findbyid mongoose

// Find the adventure with the given `id`, or `null` if not found
await Adventure.findById(id).exec();

// using callback
Adventure.findById(id, function (err, adventure) {});

// select only the adventures name and length
await Adventure.findById(id, 'name length').exec();
Posted by: Guest on September-24-2020
1

mongoose search by name

let ids = ['id1','id2','id3']
let data = await MyModel.find(
  {'_id': { $in: ids}}
);
Posted by: Guest on January-03-2021

Browse Popular Code Answers by Language