mongoose array contains code example

Example 1: 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
}

Example 2: mongoose query using an arry

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

Example 3: 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" }, ...);