【问题标题】:MangoDB: select where likeMongoDB:选择喜欢的地方
【发布时间】:2013-04-15 20:28:18
【问题描述】:

我只是在试用 Kohana MongoDB ORM:MangoDB。我想弄清楚如何做一个where like

$query['city'] = $this->request->query('location');
$results = Mango::factory('salon')
    ->load(array(
        'limit' => null,
        'criteria' => $query
    ));

我想把它改成这样:

SELECT * FROM salon WHERE city LIKE '%London%'

【问题讨论】:

  • find("city":/London/) - 请参阅 MongoDB 文档中查询中的正则表达式部分。

标签: kohana-mangodb


【解决方案1】:

MongoDB 支持正则表达式:

db.collection.find( { city: /*London*/i } );

在此处查看文档:http://docs.mongodb.org/manual/reference/operator/regex/

【讨论】:

    猜你喜欢
    • 2016-11-04
    • 1970-01-01
    • 2017-05-27
    • 1970-01-01
    • 1970-01-01
    • 2014-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多