webman mongo数据如何只获取一条记录

听泪无言

<?php
namespace app\controller;

use support\Request;
use support\Db;

class User
{
public function db(Request $request)
{
Db::connection('mongodb')->collection('test')->insert([1,2,3]);
return json(Db::connection('mongodb')->collection('test')->get());
}
}
初试webman
get()获取所有记录的对象
请问有存在返回一条记录的方法 谢谢

1339 1 0
1个回答

blogdaren

好像是有个first()方法吧,看你想要返回一条什么样的记录,具体看第三方手册:
https://github.com/jenssegers/laravel-mongodb
webman默认使用 jenssegers/mongodb 作为mongodb组件。

年代过于久远,无法发表回答
🔝