2

Is it possible to use an $exists operator inside an $elemMatch using MongoEngine?

I would like to do something like:

Location.objects(accessPoints__match={'deletedAt__exists': True, 'mac': "AC-86-74-xx-xx-xx"})

I think MongoEngine assumes that deletedAt__exists is the name of attribute in my document.

But the only way I found out to work is combining syntaxes:

Location.objects(accessPoints__match={'deletedAt': {'$exists': True}, 'mac': "AC-86-74-02-6E-70"})

Combining MongoEngine syntax and pure MongoDB syntax.

PachinSV
  • 3,680
  • 2
  • 29
  • 41

0 Answers0