3

I have the following query

{
    lessen: {
        $not: {
            $elemMatch: {
                $and: [
                    {start: {$lt: new Date()}},
                    {eind: {$gt: new Date()}}
                ]
            }
        }
    }
}

This worked perfectly until I updated to Meteor 0.8. Now it throws Error: Unrecognized operator: $and. Does anyone know how to fix this?

Damiaan Dufaux
  • 4,427
  • 1
  • 22
  • 33

1 Answers1

1

You don't need to use the $and operator in this case you can simply write the query like this:

{
    lessen: {
        $not: {
            $elemMatch: {
                start: {$lt: new Date()},
                eind: {$gt: new Date()}
            }
        }
    }
}
Damiaan Dufaux
  • 4,427
  • 1
  • 22
  • 33
  • 2
    This isn't a good answer, the question asked how to use the $and operator, not how to refactor the code. – macsj200 Aug 28 '15 at 18:46