Created
May 14, 2012 22:29
-
-
Save ovaillancourt/2697853 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var FooSchema = new Schema({ | |
dob: { type: Date}, | |
num: {type : Number}, | |
test : { | |
bla : {type: Number} | |
} | |
}); | |
FooSchema.virtual('virtualpath').get(function(){return 'Ima virtual';}); | |
mongoose.connect("mongodb://test:[email protected]/test"); | |
Foo = mongoose.model('Foo', FooSchema); | |
Foo.remove({}, function(err) { | |
var f; | |
f = new Foo({ | |
dob: Date.now(), | |
num: 1, | |
test : { | |
bla: 2 | |
} | |
}); | |
f.save(function(err) { | |
Foo.find().$or([{'test.bla' : 2},{'test.bla' : 3}]).run(function(err, doc) { | |
console.log(doc); | |
}); | |
}); | |
}); |
Thanks for the reply. It smells like a mongo version issue. Verifying now.
Alright, keep me in the loop, I'd be curious to know the resolution of this issue.
All good after updating to mongodb 2.0.5. Sorry for the false alarm and thanks again for the help.
My pleasure! Glad to hear it fixed it the issue :).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hm, weird, I'm seeing the document in my console without any problem when I run this... What version of mongodb are you using? I know that the sub-document support for the $or operator has been added with mongodb 2, could be missing if you have < 2.0.
Poking @aheckmann, got an idea?