启动时找不到指定模块怎么办,怎样解决开机提示找不到指定模块

首页 > 数码 > 作者:YD1662024-04-20 00:05:10

启动时找不到指定模块怎么办,怎样解决开机提示找不到指定模块(9)

2. Navicat for MongoDB

(1). 连接服务

启动时找不到指定模块怎么办,怎样解决开机提示找不到指定模块(10)

启动时找不到指定模块怎么办,怎样解决开机提示找不到指定模块(11)

代码演示:

1. 查询

public function testMongoDbQuery() { $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017"); $filter = ['x' => ['$gt' => 0]]; $options = [ 'projection' => ['_id' => 0], 'sort' => ['x' => -1], ]; // 查询数据 $query = new \MongoDB\Driver\Query($filter, $options); $cursor = $manager->executeQuery('test.sites', $query); foreach ($cursor as $document) { print_r($document); } }

2. 插入

public function testMongoDbInsert() { $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017"); $bulk = new \MongoDB\Driver\BulkWrite; // mongoDb默认存在一个自增长的字符串ID $document = [ '_id' => new \MongoDB\BSON\ObjectID, 'videoId' => mt_rand(1, 99999), 'userId' => mt_rand(1, 9999), 'score' => floatval(mt_rand(5,100)), 'date' => time() ]; $bulk->insert($document); $res = $manager->executeBulkWrite('tanhua.recommend_video_20191001', $bulk); return $res; }

3. 批量插入

public function testMongoDbBulk() { //return get_declared_classes(); $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017"); $bulk = new \MongoDB\Driver\BulkWrite; $bulk->insert(['x' => 1, 'name'=>'tenent', 'url' => 'http://www.runoob.com']); $bulk->insert(['x' => 2, 'name'=>'Google', 'url' => 'http://www.google.com']); $bulk->insert(['x' => 3, 'name'=>'taobao', 'url' => 'http://www.taobao.com']); $res = $manager->executeBulkWrite('test.sites', $bulk); return $res; },

上一页123末页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.