Mongoose query where the value is nonzero

Looking for a request:

Entrant .find enterDate : oneMonthAgo confirmed : true .where('pincode.length > 0') .exec (err,entrants)-> 

Am I doing the where clause correctly? I want to select documents where pincode not null

+52
mongodb mongoose
May 13 '13 at 22:00
source share
2 answers

You should be able to do this like (how do you use the api request):

 Entrant.where("pincode").ne(null) 

..., resulting in a mongo request:

 entrants.find({ pincode: { $ne: null } }) 

A few links that may help:

+92
May 13, '13 at 22:11
source share

I ended up here and my problem was what I requested

 {$not: {email: /@domain.com/}} 

instead

 {email: {$not: /@domain.com/}} 
0
Jul 28 '16 at 21:09
source share



All Articles