【发布时间】:2015-04-08 14:09:03
【问题描述】:
这是我的 MongoDB 中的文档示例:
{
"_id": ObjectId('5525039895884d66710d0fc3'),
"prid": "63527",
"data": {
"sku": "HF22-81639",
"name": "Product Test",
"ean": "8763900872512",
"description": "This product is my first test",
}
}
搜索“描述”不起作用(这是我需要帮助的地方):
app.get("/description/:id", auth, function(req, res, next) {
req.collection.findOne({
"data.description": req.params.id
}, function(e, result) {
if(e) return next(e);
res.send(result);
});
});
我需要通过一个词来查找,集合中存在的所有产品都包含在该词的描述字段中。
【问题讨论】:
标签: node.js mongodb express mongoskin