Answer the question
In order to leave comments, you need to log in
How to get part of a document in mongo?
For example, there is such a document in the authors collection:
{
"name" : "Andrew Erlichson",
"books" : {
[
{
"title" : "MongoDb best practice",
"name" : "o'Reilly",
"year" : "2013"
}
]
}
}
Answer the question
In order to leave comments, you need to log in
Found the answer in the video tutorial. Everything is solved easier:
well, or
db.authors.findOne( { name : "Andrew Erlichson" } ).books[0].year
what does null mean? first?
docs.mongodb.org/manual/reference/method/cursor.limit
"how to pull the year field value?"
docs.mongodb.org/manual/reference/method/db.collec...
Have you even read the documentation?
How to get only the zero element of the books array?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question