Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlejandro Ochoa
Courses Plus Student 10,671 PointsQuestion Using Or
in minute 4:09 as he is finishing demonstrating the or operator, he wrote the following:
db.posts.find({$or: [{title: "Parenting 101"}, {title: "My Awesome Recipe!"}]},{}) my question is what is the very last {} just before he closes the parenthesis mean...??
1 Answer
Jose Vaca Cipres
10,724 PointsThe last bracket means a "projection". The projection has the following description: Specifies the fields to return in the documents that match the query filter. To return all fields in the matching documents, omit this parameter. For details, see Projection.
It is optional and how you can see, he did not put until minute 4:12. Also, you can check the documention about of that in https://docs.mongodb.com/v3.2/reference/method/db.collection.find/#definition
Pd: Sorry for my bad English! Have a nice day! :D