I have a simple query in mongoose:
var emails = [];
User.find({ subscribed: true })
.exec(function(err, users) {
console.log(users)
if (err) {
console.log(err)
}
async.forEach(users, function(user, callback) {
if (emails.indexOf(user.email) == -1) {
console.log(user.email)
emails.push(user.email)
send(post, user.email)
callback()
}
})
})
There are 3 Users. When I run this query, only one is ever returned and it's always the same User. When I replace the line User.find({ subscribed: true })
with User.find({})
, all accounts are returned, however when the User are printed in the console they all clearly show subscribed: true
.
Additionally, the query executes as expected on my local development environment. The issue only occurs on my production server. Could this be a mongo/mongoose/Node version issue?
via Cameron Sima
No comments:
Post a Comment