I am trying to export a list of all the Reference child nodes with the attribute input. There are about 1000 documents in the collection. The desired output would be a find() query that only outputs the contents of the Reference field within the Tag field.
For example:
{
        "_id" : ObjectId("5dfb7189986b7c30f33987c3"),
        "Tag" : [
                {
                        "attribute" : "input",
                        "Reference" : "product"
                },
                {
                        "attribute" : "more",
                        "Reference" : "extra"
                }
        ]
}
Output:
[product]
My query at the moment:
db.test.find(
    {$and :
    [
        { "Tag.attribute":"input"},
        {"Tag.attribute": { $ne:null}}
    ]}
    ,{_id:0,"Tag.Reference":"1"}).pretty()
Returns:
[product,extra]
Any help would be appreciated, Thanks.
 
     
    