Chinaunix
标题:
mogodb怎么执行模糊查询,类似mysql like '%xx%'这种的
[打印本页]
作者:
yakczh_cu
时间:
2013-07-03 15:12
标题:
mogodb怎么执行模糊查询,类似mysql like '%xx%'这种的
类似mysql like '%xx%'这种的
作者:
horizonhyg
时间:
2013-07-05 17:24
回复
1#
yakczh_cu
使用正则表达式:
db.collection.find( { field: /acme.*corp/i } );
db.collection.find( { field: { $regex: 'acme.*corp', $options: 'i' } } );
复制代码
http://docs.mongodb.org/manual/reference/operator/regex/
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2