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

Find Project exercise: incorrect example and resource link #68

Open
VAggrippino opened this issue Mar 17, 2018 · 0 comments
Open

Find Project exercise: incorrect example and resource link #68

VAggrippino opened this issue Mar 17, 2018 · 0 comments

Comments

@VAggrippino
Copy link

In the Find Project exercise, we're supposed to return documents with only the name and age properties using the MongoDB Node.js Driver.

The example provided shows a projection argument to the collection's find() method and references the documentation for this method as a resource link. However, this is the method's implementation in Mongo Shell. The find() method in NodeJS doesn't have a projection argument. Instead, a projection is applied using the project() method on the Cursor returned by find().

An accurate example would look like this:

collection.find({
  name: 'foo'
}).project({
  name: 1,
  age: 1,
  _id: 0
})

References:

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