ruby on rails - Mongoid pluck function not working as expected on subdocuments -
i have mongo shell query working , im trying duplicate mongoid.
here works in mongo shell
db.getcollection('accounts').find({field1: 'test'}, {'field1': 1, 'subdocs.field2': 1})
according this answer, pluck method should work, returns nil subdocs.field2
though there value in document.
>>account.where(field1: 'test').pluck(:field1, 'subdocs.field2') [['test', nil], ['test', nil]]
does know i'm doing wrong?
Comments
Post a Comment