1. 程式人生 > >PHP連線mongodb的現代用法---使用Monogodb\Driver\Manager

PHP連線mongodb的現代用法---使用Monogodb\Driver\Manager

<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/29
 * Time: 2:23
 */
//require("mongoconn.php");
$wenwa = new MongoDB\Driver\Manager('mongodb://localhost:27017');
$filter=['_id'=>['$gte'=>0]];
$options=array();
$query = new MongoDB\Driver\Query($filter,$options);
$rows = $wenwa->executeQuery('
olddream.color',$query); echo var_dump($rows); $i=0; foreach($rows as $v) { ++$i; } echo $i; ?>