I am trying to find certain visits coming from an ip.The visits schema looks like this :
var VisitSchema = new Schema({
visitId: String,
ip: [{ type: Schema.Types.ObjectId, ref: 'VisitorIp' }]
});
mongoose.model('Visit', VisitSchema);
the ip schema looks like this :
var VisitorIpSchema = new Schema({
ip: String,
country: String
});
mongoose.model('VisitorIp', VisitorIpSchema);
when i try to run the normal find for a specific ip :
Visit.find({ip.ip:myIp}))
.populate('ip')
.exec(function(err, visits){
console.log(visits)
})
it returns an empty array. All the recordings in the mongo database look and behave normally.
Please help I have run out of ideas.