mongodb - $or mongoose operator works on localhost but not on production -
i have force web application on prod server , find surprising issue:
var username = 'foo'; var user = this.db.model('user', userschema); user.findone({ $or: [ { username: username }, { email: { value: username } } ] }, 'id', function(err, doc) { if (err) { console.log(err); }else if (doc) { console.log('ok'); }else { console.log('any result'); } });
this exact same code works on localhost not on prod server (i go in else
status on production server , in else if (doc)
on localhost).
i print variable username
before findone
phone call , checked manually, username exist.
if drop $or
operator , apply status on username
, works !! proof $or
operator responsible of failure.
i update node modules same way on both environements ("mongoose": ">=3.5.4"
).
my mongodb version same on both environements:
db version v2.0.4, pdfile version 4.5 git version: nogitversion
my localhost server: unbuntu
. prod server: debian
.
how explain ?
thanks.
i have upgraded mongodb v2.2.3
on prod server , works...
mongodb mongoose
No comments:
Post a Comment