“Монгуз найти в массиве” Ответ

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();
Cheerful Cockroach

мангуозный запрос с использованием Arry

var query = PUser.find({'userID': {$in:array}});
Outstanding Otter

Монгуз найти в массиве

Or, if teamIds is a string of comma-separated id values, you need to convert it into an array of values using split:
Team.find({
    '_id': { $in: teamIds.split(',') }
}, function(err, teamData) {
    console.log("teams name  " + teamData);
});
stacklord

Monngoose находит из массива, используя в

//If teamIds is already an array, then you shouldn't wrap it in another array:

Team.find({
    '_id': { $in: teamIds }
}, function(err, teamData) {
    console.log("teams name  " + teamData);
});

//If teamIds is a string of comma-separated id values, you need to convert it into an array of values using split:

Team.find({
    '_id': { $in: teamIds.split(',') }
}, function(err, teamData) {
    console.log("teams name  " + teamData);
});

Jaimin Patel

Monngoose находит из массива, используя в

//e.g. : There's an array of Team Ids which needs to find documents from db
Team.find({
    '_id': { $in: teamIds.split(',') }
}, function(err, teamData) {
    console.log("teams name  " + teamData);
});
Jaimin Patel

Ответы похожие на “Монгуз найти в массиве”

Вопросы похожие на “Монгуз найти в массиве”

Больше похожих ответов на “Монгуз найти в массиве” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования