I have a collection of documents like this:
{
"_id" : ObjectId("532d4e7d569c9e4574d5156e"),
"title" : "Book Title"
"author" : "Book Author",
"owner" : "532d4e7c569c9e4574d51568",
"pages" : [
{
"texts" : [
{
"_id" : ObjectId("532d4e7d569c9e4574d51572"),
"paragraphs" : [ ],
"format" : [ ],
"position" : {
"y" : 0,
"x" : 0
}
}
],
"images" : [
{
"_id" : ObjectId("532d4e7f569c9e4574d51573"),
"position" : {
"y" : 0,
"x" : 0
}
}
],
},
{
"_id" : ObjectId("532d4e7d569c9e4574d51571"),
"videos" : [ ],
"audios" : [ ],
"images" : [ ],
"texts" : [ ],
"animations" : [ ]
}
]
}
and I want to get the only text
subdocument with _id
:
db.projects.find({'pages.texts._id': ObjectId("532d4e7d569c9e4574d51572")}, {'pages.$.texts.$': 1}).pretty()
but it's not works.
I want to get only this part of document:
{
"_id" : ObjectId("532d4e7d569c9e4574d51572"),
"paragraphs" : [ ],
"format" : [ ],
"position" : {
"y" : 0,
"x" : 0
}
}