#all documents whose country field value is not neither Portugal or Spain
query = db.collection.find({
"country" : { '$nin': [
'Portugal',
'Spain']
}
})
-- Syntax: { field: { $nin: [ <value1>, <value2> ... <valueN> ] } }
db.inventory.find( { quantity: { $nin: [ 5, 15 ] } }, { _id: 0 } )
Code Example |
---|
:: |
:: |
:: |
:: |
:: |
:: |
:: |
:: |
Javascript :: |
:: |
:: |
:: |
:: |
Javascript :: |
:: |
:: |
:: |
Javascript :: |
Javascript :: |
Javascript :: |
:: |
:: |
:: |
:: |
Javascript :: |
:: |
:: |
:: |
:: |
:: |