2014년 12월 28일 일요일

[mongodb-csharp] $elemMatch is returning all the subdocuments in the array inspite of specifying the required value

db.test.find({ testArray: { $elemMatch : { payMethod : 'NetBanking' } } }, {'testArray': 1}).limit(1)

My query above should return only that subdocument from the testArray whose 'payMethod' field is equal to 'NetBanking'

I am not only getting the matching subdocument from the array but all the other subdocuments too.

I just want that subdocument from the array that matches using $elemMatch above.


댓글 없음:

댓글 쓰기