When findOne fails to return an existing user, the mongodb error is "Error: No replica set primary available for query with ReadPreference PRIMARY". Maybe it's a problem with the node driver?
I
Igor
said
over 7 years ago
As mentionned by Ivan Stoyanov in another post - how do ref them? - retrying the query when returned user is null does solve the issue.
Igor
modules.collectionAccess.collection('user').findOne({"username": request.username}, function(err, user) {
if (!user) {
logger.fatal(request.username + ' not found');
response.complete(400);
} else {
...
}
});
Every few saves from the same user, I get an error (null user returned by findOne).