at least one in mongodb

1999 views mongodb

I have a database related to movies. This is how i inserted my data in the database:
db.Movieinfo.insert({ "MovieID":1, "MovieName":"iron man", "Actor":"Robert downey", "ReleaseDate":2008, "GotOscars":1,
}) But when i do the following to get the list of movies which returns only movies that have won at least one oscar or more: db.Movieinfo.find({"MovieName":1},{"GotOscars":{$gte:1}}), it gives all the movies that haven't won oscar also. Could anyone please help me with this? Thank you in advance.

answered question

db.Movieinfo.find({ "GotOscars":{$gte:1} })

1 Answer


try this

db.Movieinfo.find({"GotOscars":{$gte:1}}) you were passing 2 arguments and another argument was considered as projection.

posted this

Have an answer?


Please login first before posting an answer.