如果我的mongodb中的数据是这样的
{
"category": "Pop Culture",
"subcategory": "Film Directors",
"name": "Quentin Tarantino",
}有没有办法只使用名称的某个部分就可以找到这个对象?
比如:
db.data.find_one({'name': 'quentin'})发布于 2020-06-23 09:11:11
对于string数据,可以使用$regex运算符查找字段数据的某些部分。
示例:
db.collection.findOne({
name: {
$regex: "Some part of name"
}
})有关详细信息,请参阅$regex。
https://stackoverflow.com/questions/62531183
复制相似问题