码迷,mamicode.com
首页 > 数据库 > 详细

使用PHP操作MongoDB数据库

时间:2018-11-17 19:18:45      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:http   amp   数据   god   command   mongo   mongodb扩展   cut   config   

1.连接MongoDB数据库(在已安装php-mongodb扩展的前提下)


$config = "mongodb://{$user}:{$pass}@{$host}:{$port}";
$mongodb = new \MongoDB\Driver\Manager($config );

2.简单统计


$command = new \MongoDB\Driver\Command(['count' => $collection,'query'=>$filter]);
$result = $mongodb->executeCommand($db,$command);

原文地址:https://segmentfault.com/a/1190000016113918

使用PHP操作MongoDB数据库

标签:http   amp   数据   god   command   mongo   mongodb扩展   cut   config   

原文地址:https://www.cnblogs.com/lalalagq/p/9974797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!