【发布时间】:2014-12-16 13:25:40
【问题描述】:
我正在尝试调整 here 的全文搜索以与流星一起使用。我将 mongodb url 导出到运行 2.6.1 的一个。使全文搜索兼容,但我收到这些错误server/search.js:2:15: Unexpected token .andserver/search.js:42:7: Unexpected token )。我错过了什么?
server.js
Meteor.methods({
Meteor.ensureIndex("Posts", {
smaintext: "text"
}, function(err, indexname) {
assert.equal(null, err);
});
)
};
Meteor.methods({
feedupdate: function(req) {
Posts.find({
"$text": {
"$search": req
}
}, {
smaintext: 1,
submitted: 1,
_id: 1,
Posts: {
$meta: "Posts"
}
}, {
sort: {
textScore: {
$meta: "posts"
}
}
}).toArray(function(err, items) {
for (e=0;e<101;e++) {
Meteor.users.update({
"_id": this.userId
}, {
"$addToSet": {
"profile.search": item[e]._id
}
});
}
})
}
)
};
【问题讨论】:
标签: node.js mongodb search meteor mongodb-query