使用MongoDB 3.0.14
使用节点驱动程序,maxTimeMS:QUERY_TIME是updateOne的有效选项吗?或者我可以在下面的代码中使用同样的选项吗?
现在,当我通过关闭mongodb守护程序引发错误时,我得到MongoError: failed to reconnect after 30 attempts with interval 1000 ms
var QUERY_TIME = 500;
TempUsers.prototype.add = function(body, token) {
const user = { "email" : body.email };
return this.collection.updateOne(user,
{ $set: {
// TO DO - ADD PHONE NUMBER
"token": token,
"createdAt": new Date(),
}
},
{
writeConcern: true,
maxTimeMS: QUERY_TIME,
upsert: true
}
);
};
module.exports = TempUsers;