Answers for "mongoose array includes"

3

Find document with array that contains a specific value

As favouriteFoods is a simple array of strings, you can just query that field directly:

PersonModel.find({ favouriteFoods: "sushi" }, ...);

model:
person = {
    name : String,
    favoriteFoods : Array
}
Posted by: Guest on July-19-2020
0

mongoose query using an arry

var query = PUser.find({'userID': {$in:array}});
Posted by: Guest on May-15-2020
0

mongoose array includes

// As favouriteFoods is a simple array of strings, 
// you can just query that field directly:

// favouriteFoods contains "sushi"
PersonModel.find({ favouriteFoods: "sushi" }, ...);
Posted by: Guest on May-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language