mongoose query using an arry
var query = PUser.find({'userID': {$in:array}});
mongoose query using an arry
var query = PUser.find({'userID': {$in:array}});
mongoose find in array
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);
});
monngoose find from an array using in
//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);
});
monngoose find from an array using in
//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);
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us