mongodb search model for array element code example
Example 1: how to get array object value in mongodb
db.products.aggregate([
{$unwind: "$ratings"},
{$match: {'ratings.user': ObjectId("5f6e2e0b70eb0208fc8401a1")}}
])
Example 2: mongodb array field contains
db.inventory.find( { tags: { $all: ["red", "blank"] } } )
Example 3: mongo array
db.inventory.find( { tags: ["red", "blank"] } )