Home > Database > Mysql Tutorial > mongodb奇怪模糊查询问题

mongodb奇怪模糊查询问题

WBOY
Release: 2016-06-07 17:56:44
Original
1038 people have browsed it

db.keke.insert({name:"hky"}); db.keke.find() { "_id" : ObjectId("50222ec21905597a6291d35c"), "name" : "hky" } db.keke.find({"name":{$regex:'hk'}}); { "_id" : ObjectId("50222ec21905597a6291d35c"), "name" : "hky" } 但是 db.keke.find({name:/h

db.keke.insert({name:"hky"});

db.keke.find()
{ "_id" : ObjectId("50222ec21905597a6291d35c"), "name" : "hky" }

db.keke.find({"name":{$regex:'hk'}});

{ "_id" : ObjectId("50222ec21905597a6291d35c"), "name" : "hky" }

但是

db.keke.find({name:/hk/});

就返回空,虚拟主机,美国空间,很多资料都说可以用db.keke.find({name:/hk/});方式模糊查询啊,美国服务器,为什么我的不行?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template