Ticket: Projection in Node.JS

cursor = await movies.find({ countries: { $all: countries } }, { title: 1, _id:0 });

This the query I am using and the countries list is - [“Russia”, “Japan”, “Mexico”] and I am getting a 304 Http Response and an empty array in response, perhaps the correct response should be list of 1468 items . Please look into this and let me know how can I solve this.

I would recheck the lab requirement for _id field and the operator used to query. :slight_smile:

Thanks @kanikasingla. I have solved my issue . The correct query is

cursor = await movies.find({ countries: { $in: countries } },{projection: { title: 1 }});

2 Likes