0

I have the following query in pymongo:

query2 = {"$and": [{'eventMetadata.doc.DocId':{"$exists":True}},
                   {'eventMetadata.doc.DocId':{"$not":{"$regex": "-"}}}]
         }

This works. Basically means that the indicated field exists AND that does not contain the regex "-" which basically means that it does not contain "-" I would like to know if there is a better way to check if "-" is not in the desired result without regex and also how could I check that the record is a number.

The following does not work and I dont know why:

query3 = {'eventMetadata.doc.DocId': {"$isNumber":True}} 

--> giving cero results even If I know there are a lot of fields consisting in just in numbers (no alpha characteres)

JFerro
  • 3,203
  • 7
  • 35
  • 88

1 Answers1

0
quantotto
  • 31
  • 4