We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4c74395 + d52fbb0 commit 4283cf6Copy full SHA for 4283cf6
1 file changed
ThinkPHP/Library/Think/Model/MongoModel.class.php
@@ -306,10 +306,10 @@ public function getField($field,$sepa=null) {
306
// 返回数据个数
307
if(true !== $sepa) {// 当sepa指定为true的时候 返回所有数据
308
$options['limit'] = is_numeric($sepa)?$sepa:1;
309
- } // 查找一条记录
310
- $result = $this->db->find($options);
+ } // 查找符合的记录
+ $result = $this->db->select($options);
311
if(!empty($result)) {
312
- if(1==$options['limit']) return reset($result[0]);
+ if(1==$options['limit']) return reset($result)[$field];
313
foreach ($result as $val){
314
$array[] = $val[$field];
315
}
0 commit comments