I have a document like this:
{ "InDate": "11.09.2015", "Kst2Kst": true, "OutDate": "11.09.2015", "__v": 0, "_id": ObjectId('55f2df2d7e12a9f1f52837e6'), "accepted": true, "inventar": [ { "accepted": "1", "name": "AAAA", "isstammkost": true, "stammkost": "IWXI" }, { "accepted": "1", "name": "BBBB", "isstammkost": false, "stammkost": "null" } ] }
I want to select some data from the main document and the data with "isstammkost": true in the inventar-array.
Move.findOne({tablename: tablename, accepted : true, "inventar.isstammkost" : true}, 'OutDate InDate inventar.ean', {"inventar.$": 1}, function(err, res) {...