node.js - Using Mongoose middleware find query document from MongoDB -


i'm using mongoose middleware connect mongodb.

i have mongodb collection:

{ "_id" : objectid("54801a4def32fe8c2bc642a6"), "name" : "cyber kok", "serial" : null }  { "_id" : objectid("54801a4def32fe8c2bc642a5"), "name" : "cyber kok", "serial" : "" }  { "_id" : objectid("54801a4def32fe8c2bc642a7"), "name" : "cyber kok", "serial" : " " }  { "_id" : objectid("54801a4def32fe8c2bc642a8"), "name" : "cyber kok", "serial" : "14a16" }  { "_id" : objectid("54801a4def32fe8c2bc642a9"), "name" : "cyber kok", "serial" : "19b20" } 

how query mongodb collection using mongoose display below in 1 command?

{ "_id" : objectid("54801a4def32fe8c2bc642a6"), "name" : "cyber kok", "serial" : null } { "_id" : objectid("54801a4def32fe8c2bc642a5"), "name" : "cyber kok", "serial" : "" } { "_id" : objectid("54801a4def32fe8c2bc642a7"), "name" : "cyber kok", "serial" : " " } 

thank you. wj.

try

model.find({$or : [{serial: ""}, {serial: " "}, {serial: null}]}, function(){...}); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -