regex - Negative Look Around in MongoDB Query -


for fields, uploaded. want make sure didn't corrupted (not mongo, data generator).

the field of interest take regex:

donor_\d{1,2}_\d+ 

for example:

donor_17_82635294 

there no exception rule, wondering if use negative around in regex find fields don't meet rule. problem negative around examples on seems have know looking for, don't. want this.

db.collection.find({field:*not*/donor_\d{1,2}_\d+/i}) 

my other option create new collection matches regex, easier.

thanks j

yes can negation of regular expression this:

db.collection.find({field: { $not: /donor_\d{1,2}_\d+/i } }) 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -