Unlike most SQL databases, MongoDB can store values inside arrays and hashes. Now, we shall see how we can search inside arrays.
Did you know that most of the operators we learned about earlier, could be used directly on arrays inside a document just like normal fields? For example:
> db.books.insert( { "categories" : [ " Drama", "Action"] } )
> db.books.find( { categories : { $ne : "Romance"} } )
This will return the document we inserted previously. Isn't that cool?!
18.118.27.99