这是我的链接架构:
var LinkSchema = new Schema({
user: ObjectId,
text: {
type: String,
validate: [required,"Text is required"],
index: {unique: true}
},
body: {
type: String,
validate: [required, 'Body is required'],
index: { unique: true }
},
createdAt: {
type: Date,
'default': Date.now
}
});
这是我的getLink:
LinkSchema.statics.getLink = function(apiKey,fn){
var query = link.find('link.user.apiKey': apiKey);
query.exec(function (err, links) {
if (err) return handleError(err);
res.send(items);
});
}
错误:
Unexpected Token':' -> var query = link.find('link.user.apiKey': apiKey);
我想我在做 mongoosejs 的 find() 错误。我该如何解决?