Ticket: Projection issue

Sir could you tell me the solution for Ticket: Projection…

The code below :-

return list(db.movies.find({“countries”:{$in:countries}}, {"_id":1, “title”:1}).limit(1))

shows an error :-

return list(db.movies.find({“countries”:{$in:countries}}, {"_id":1, “title”:1}).limit(1))

I can understand that $ is not a keyword in python then what to use instead…
As per your instruction I created a new issue, You said to put everything except variables in double quotes could you please give a simple example…

Although the queries are simple but due to very first handson for running MongoDB queries in python, are we provided with any document or txt file, which could help us with the code

Got the solution:
return list(db.movies.find({“countries”: {"$in": countries}},{“title”:1}))

1 Like

Could someone please help me with my second question of any file that could help??

It is not clear what is your second question.

Second Question:

There are some jupyter notebooks that can help guide you with the common queries.

Also, API is always the best option to learn how commands work.

Kanika