I am trying to covert this query

```
db.getCollection('queues').find({
    $and:[
        {queue: 'testo'},
        {$or: [
            {$and: [{reserved_at: null}, {available_at:{'$lte':1490323024}}]},
            {reserved_at:{'$lte':1490323024}}
        ]}
    ]
});

```

to doctrine but I am getting this error.

```
Can't canonicalize query: BadValue $or/$and/$nor entries need to be full objects.

```

This is what I tried.

```
$builder = $this->get('doctrine_mongodb')->getManager()->createQueryBuilder('AppBundle:Ticket');

$builder->findAndUpdate()->addAnd([
    $builder->field('queue')->equals($queue),
    $builder->addOr([
        $builder->addAnd([
            $builder->field('reservedAt')->equals(null),
            $builder->field('availableAt')->lte($currentTime)
        ]),
        $builder->field('reservedAt')->lte($expiration)
    ])
])
->sort('id', 'ASC')
->limit(1)
->field('reservedAt')->set($currentTime->getTimestamp());

$job = $builder->getQuery()->execute()->toArray();

```

Whats wrong with this code can someone give me any hint.