MongoDB
作者:互联网
安装
linux,
windows,
php扩展,
代码使用
无框架php7
//插入数据到mongodb,的test数据库,runoob表中
$bulk = new MongoDB\Driver\BulkWrite;
$document = ['_id' => new MongoDB\BSON\ObjectID, 'name' => '菜鸟教程'];
$_id= $bulk->insert($document);
var_dump($_id);
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite('test.runoob', $bulk, $writeConcern);
可视化
可以使用github开源web办可视化工具adminmongodb
git clone --depth=1 https://github.com/mrvautin/adminMongo.git
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install
npm start
标签:npm,MongoDB,Driver,bulk,new,id 来源: https://www.cnblogs.com/yudubujue/p/15494141.html