mongodb - Checking nested property that can be null -


i've following data in collection:

{ colour: { r: 0, g: 0, b: 0 }}, { colour: null }, 

how can find documents have colour == null or color.r between values?

i've tried

.find({ where: { $or: [{colour: null}, {"colour.r": {$gt: 0, $lt: 100}}]}}) 

but of course gives me cannot read property 'r' of null null rows.

use $where if there no other way express query

db.test.find({$or: [{"colour": null}, {"colour.r": {$gt: 0, $lt: 100}}]}) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -