当我使用时,我使用带有代码点火器的库 php mongodb limit(1)
它返回的结果数组为空,但是当我使用 limit(2)
或 limit(n)
返回结果对我来说是正确的,我不知道为什么?
以下是我要使用的代码:
> $resutl = $this->mongo_db->limit(1)->get('UserProfile');
信息库:
/**
* CodeIgniter MongoDB Active Record Library
*
* A library to interface with the NoSQL database MongoDB. For more information see mongodb.org
*
* @package CodeIgniter
* @author Alex Bilbie
* @copyright Copyright (c) 2010, Alex Bilbie.
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://alexbilbie.com
* @version Version 0.5.2
*
* Thanks to Kyle Dye (kyledye.com), Nick Jackson (nickjackson.me), Mikhail Kozlov (mikhailkozlov.com) and Phil Sturgeon (philsturgeon.co.uk) for additional help
*/
我不知道
它是否对你有用,你肯定会对它有所了解。
$links = $this->mongo_db
->where(array(
'status' => 1,
'siteid' => 1
))->where_lt('publishedtime', $start)->order_by(array('publishedtime'=>'desc'))
->limit(10)->get('links');
或
$query = $this->CI->cimongo->limit(1)->get_where($table, array($field => $str));