Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thanks for the help on the projection #3

Open
Ohshi60 opened this issue May 9, 2018 · 0 comments
Open

Thanks for the help on the projection #3

Ohshi60 opened this issue May 9, 2018 · 0 comments

Comments

@Ohshi60
Copy link

Ohshi60 commented May 9, 2018

Hi, i just wanted to say your code saved me from a nightmare, and i was hoping you could help me explain a bit. The issue is with the lesson 4 project find:
The official docs state that i can use collection.find with a query and a projection
https://docs.mongodb.com/manual/reference/method/db.collection.find/#explicitly-exclude-the-id-field
collection.find({ age: { $gt: +age } }, { _id: 0 })
but the code doesnt apply the projection unless i do it like in your solution wrapping the projection in fields:
.find({ age: { $gt: +age } }, { fields: { _id: 0 } })

So i guess my question is? How did you know to apply the fields: in the projection, i cant find it in the official docs

Again thank you very much i was stuck on this problem for so long, just hoping for a bit of clarification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant