The M001 course reiterates that mongo uses an implicit $and
operator for search queries.
ie:
Implicitly, a logical
AND
conjunction connects the clauses of a compound query so that the query selects the documents in the collection that match all the conditions.
source
However, this does not seem to be the case when the fieldnames are the same. ie
{ status: "A", status: "B" }
…actually corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status = "A" OR status = "B"
Maybe this is obvious here, but when querying arrays with the implicit “field contains at least *one* element with the specified value” (source) syntax, I was expecting:
db.inventory.find( { tags: "red", tags: "blank" } )
…to correspond to the following SQL statement:
SELECT * FROM inventory WHERE tags IN ("red") AND tags IN ("blank")
…but of course it doesn’t.
I dont mean to be pedantic but perhaps this could be clearer in the docmentation?