Php MongDB limit(1)返回结果数组为空
当我使用Php MongDB limit(1)返回结果数组为空,php,mongodb,codeigniter,limit,Php,Mongodb,Codeigniter,Limit,当我使用limit(1)it返回结果数组为空时,我使用了带有codeigniter的php mongodb库,但当我使用limit(2)或limit(n)时,返回结果对我来说是正确的,我不知道为什么 下面是我要使用的代码: > $resutl = $this->mongo_db->limit(1)->get('UserProfile'); 信息库: /** * CodeIgniter MongoDB Active Record Library * * A l
limit(1)
it返回结果数组为空时,我使用了带有codeigniter的php mongodb库,但当我使用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));