时间:2021-07-01 10:21:17 帮助过:3人阅读
$collection = (new MongoDB\Client)->test->users;
// 增加一条
$insertOneResult = $collection->insertOne([
'username' => 'admin',
'email' => 'admin@example.com',
'name' => 'Admin User',
]);
// 增加多条
$insertManyResult = $collection->insertMany([
[
'username' => 'admin',
'email' => 'admin@example.com',
'name' => 'Admin User',
],
[
'username' => 'test',
'email' => 'test@example.com',
'name' => 'Test User',
],
]);
php--MongoDB的使用
标签:any amp code pre mongo user mail col mon