我的问题是,当我尝试发布特定的URL时,我发现我的Heroku服务器已损坏,但是我还发现执行更新和向Atlesdb的插入。我的日志显示:
2020-02-19T09:37:32.708336 + 00:00 heroku [web.1]:状态从向上更改为崩溃
2020-02-19T09:37:32.694639 + 00:00 heroku [web.1]:进程退出 状态1 2020-02-19T09:37:32.638247 + 00:00 app [web.1]: /app/node_modules/mongodb/lib/utils.js:133
2020-02-19T09:37:32.638289 + 00:00 app [web.1]:抛出错误;
2020-02-19T09:37:32.638290 + 00:00 app [web.1]:^ 2020-02-19T09:37:32.638291 + 00:00 app [web.1]:
2020-02-19T09:37:32.638292 + 00:00 app [web.1]:MongoWriteConcernError: 在副本集中找不到名为“ oritymaj”的写关注模式 配置2020-02-19T09:37:32.638293 + 00:00应用程序[web.1]:在 连接。 (/app/node_modules/mongodb/lib/core/connection/pool.js:461:23)
2020-02-19T09:37:32.638293 + 00:00 app [web.1]:位于Connection.emit (events.js:311:20)
2020-02-19T09:37:32.638294 + 00:00 app [web.1]:在processMessage
(/ app / node_modules / mongodb / lib / core / connection / connection.js:384:10)
2020-02-19T09:37:32.638294 + 00:00 app [web.1]:位于TLSSocket。
(/ app / node_modules / mongodb / lib / core / connection / connection.js:553:15)
2020-02-19T09:37:32.638295 + 00:00 app [web.1]:位于TLSSocket.emit (events.js:311:20)
2020-02-19T09:37:32.638295 + 00:00 app [web.1]:在addChunk上 (_stream_visible.js:294:12)
2020-02-19T09:37:32.638296 + 00:00 app [web.1]:在可读AddChunk (_stream_visible.js:275:11)
2020-02-19T09:37:32.638296 + 00:00 app [web.1]:在 TLSSocket.Readable.push(_stream_visible.js:209:10)
2020-02-19T09:37:32.638297 + 00:00 app [web.1]:位于TLSWrap.onStreamRead
(内部/stream_base_commons.js:186:23){
2020-02-19T09:37:32.638297 + 00:00 app [web.1]:代码:79,
2020-02-19T09:37:32.638298 + 00:00 app [web.1]:代号: 'UnknownReplWriteConcern',
2020-02-19T09:37:32.638298 + 00:00 app [web.1]:errmsg:“无写问题 副本集配置中找到名为“ oritymaj”的模式”,
2020-02-19T09:37:32.638299 + 00:00 app [web.1]:名称: 'MongoWriteConcernError',
2020-02-19T09:37:32.638299 + 00:00 app [web.1]:结果:{
2020-02-19T09:37:32.638299 + 00:00 app [web.1]:n:1,
2020-02-19T09:37:32.638300 + 00:00 app [web.1]:opTime:{ts: [时间戳记],t:3},
2020-02-19T09:37:32.638300 + 00:00 app [web.1]:lectionId: 7fffffff0000000000000003,
2020-02-19T09:37:32.638300 + 00:00 app [web.1]:好的:1,
2020-02-19T09:37:32.638301 + 00:00 app [web.1]:writeConcernError:{
2020-02-19T09:37:32.638301 + 00:00 app [web.1]:代码:79,
2020-02-19T09:37:32.638301 + 00:00 app [web.1]:代号: 'UnknownReplWriteConcern',
2020-02-19T09:37:32.638302 + 00:00 app [web.1]:errmsg:“无写问题 副本集配置中找到名为“ oritymaj”的模式”
2020-02-19T09:37:32.638302 + 00:00 app [web.1]:},
2020-02-19T09:37:32.638303 + 00:00 app [web.1]:'$ clusterTime':{ clusterTime:[Timestamp],签名:[Object]},
2020-02-19T09:37:32.638303 + 00:00 app [web.1]:operationTime:时间戳记 { bsontype:'Timestamp',low :1,high_:1582105052}
2020-02-19T09:37:32.638303 + 00:00 app [web.1]:},
2020-02-19T09:37:32.638304 + 00:00 app [web.1]: [Symbol(mongoErrorContextSymbol)]:{}
2020-02-19T09:37:32.638304 + 00:00 app [web.1]:}
2020-02-19T09:37:32.645504 + 00:00 app [web.1]:npm错误!代码ELIFECYCLE
2020-02-19T09:37:32.645837 + 00:00 app [web.1]:npm错误! errno 1
Rq:该应用程序可以在我自己的本地服务器上正常运行
节点js服务器
app.post('/currentusers',(request,response,next)=>{
var post_data = request.body;
var user_email = post_data.user_email;
var user_lat = post_data.user_lat;
var user_long = post_data.user_long;
var date = post_data.date;
var insertJSON1 = {
'user_email':user_email,
'user_lat':user_lat,
'user_long':user_long,
'date':date
};
var db = client.db('transpertor');
db.collection('Currentusers').find({'user_email':user_email}).count(function(err,number){
if(number ==0){
db.collection('Currentusers').insertOne(insertJSON1,function(error,res){
if(error) throw error;
response.json('L entregistrement des infos des users été effectuer avec sucess');
console.log('L entregistrement des infos des users a été effectuer avec sucess');
});
}else{
response.json('infos updated');
db.collection('Currentusers').updateMany({'user_email':user_email}, {$set:{'user_lat':user_lat,'user_long':user_long,'date':date}}, function(err, result) {
if(error) throw error;
response.json('infos updated');
console.log('infos updated');
});
}
});
});