“Mongoose hallazgo en la matriz” Código de respuesta

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

consulta de mangosta usando un arry

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

Mongoose hallazgo en la matriz

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 encuentra desde una matriz usando en

//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 encuentra desde una matriz usando en

//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

Respuestas similares a “Mongoose hallazgo en la matriz”

Preguntas similares a “Mongoose hallazgo en la matriz”

Más respuestas relacionadas con “Mongoose hallazgo en la matriz” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código