<?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()獲取所有記錄的對(duì)象
請(qǐng)問有存在返回一條記錄的方法 謝謝
好像是有個(gè)first()方法吧,看你想要返回一條什么樣的記錄,具體看第三方手冊(cè):
https://github.com/jenssegers/laravel-mongodb
webman默認(rèn)使用 jenssegers/mongodb 作為mongodb組件。