Skip to content Skip to sidebar Skip to footer

Mongo Db Not Equal To Query Not Working

I am trying to select all different from 'overview' in a mongodb collection. I use the query below but it does not work... hist = db.find({'type':{$ne:'overview'}}) If I try witho

Solution 1:

You need to put quotation marks around $ne since pymongo uses dicts as parameters. It can't interpret { $ne : 'overview' } since $ne isn't a variable. Long story short, try this:

hist = db.find({'type':{'$ne':'overview'}})

Solution 2:

You're colon for $ne is inside the quotes, change to:

hist = db.find({'type':{$ne:'overview'}})

Post a Comment for "Mongo Db Not Equal To Query Not Working"