我有两个模式。
tables.js
:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var SchemaOne = new Schema({
TheDate: { type: String },
ThePiece: {type: String }
}, { versionKey: false });
var SchemaTwo = new Schema({
UrlLink: { type: String },
Name: { type: String },
Type: { type: String },
Thing: { type: String },
NewInfo: [SchemaOne]
}, { versionKey: false });
module.exports = mongoose.model('tables', SchemaTwo);
然后我导入上面的文件:
var ThisTable = require("../models/tables.js");
然后我尝试更新NewInfo
对象(如果满足某些条件):
ThisTable.update({ UrlLink: Myurl }, {
$addToSet: {
"NewInfo": {
TheDate: ThisDate,
ThePiece: ThisPiece
}
}
});
我做错了吗?因为脚本崩溃而我无法通过远程计算机的某些限制进行调试。