0

I want to use $in for id field of inner DBRef object and do in such a way:

{users: {$elemMatch: {device: {'$ref': 'devices', '$id' : { "$in" : [ 'deviceId' ] }}}}}

In response I get nothing(but I should).

If I query on exact id it works ok:

{users: {$elemMatch: {device: {'$ref': 'devices', '$id' : "deviceId"}}}}

So my question is if it possible to query with $in and how I can do that.

UPD: Here is my document example:

{
    _id: ObjectId
    name: "group name"
    users: [
        {
            _id: ObjectId
            device: DBRef('devices', 'deviceId', undefined)
        }
    ]
}
Vlad Hanzha
  • 464
  • 3
  • 11

0 Answers0