在我的mongo中我有文件
{
"_id": ObjectId("56658b4b9f41447c29f8d78e"),
"hostname": "VSX-01",
"time": "15:03:11",
"day": "7",
"con": [
"100000",
"4994",
"9",
"19904",
"7772",
"13323",
"245",
"14",
"221"
],
"cpu": [
"0",
"0",
"0",
"102",
"20",
"0",
"0",
"0",
"0"
],
"__v": 0
}
并且喜欢使用下面的mongoose查询来查找和更新它,没有任何反应,打印
var newMessage = new Message(conmessage);
console.log(conmessage); /* Prints { hostname: 'VSX-01',
cpu: [ 0, 0, 0, '102', '20', 0, 0, 0, 0 ],
con: [ '100000', '4994', '9', '19904', '7772', '13323', '245', '14', '221' ],
time: '15:03:11',
day: '7' }*/
newMessage.find({'time': conmessage.time}, //findOneAndUpdate
function(err, message) {
if (err) throw err;
console.log(message);
})
我的架构var messageSchema = new Schema({hostname:String,cpu:[String],con:[String],time:String,day:String});
答案 0 :(得分:1)
你能给你的架构吗?我不检查这段代码,但我认为这会对你有帮助。 您可以尝试使用以下代码:
txtCostPerPerson