I\'m trying to connect PHP 7 with mongoDB, I installed the \"new\" MongoDB driver using pecl by following this page instructions. I can see MongoDB version 1.1.8 from phpI
The page that you are referring to is the low-level PHP driver for MongoDB. The API is the same as the HHVM driver for MongoDB. The documentation for both of them is the same, and can be found at http://docs.php.net/manual/en/set.mongodb.php
The driver is written to be a bare bone layer to talk to MongoDB, and therefore misses many convenience features. Instead, these convenience methods have been split out into a layer written in PHP, the MongoDB Library. Using this library should be your preferred way of interacting with MongoDB.
The library needs to be installed with Composer, a package manager for PHP. See also Get Composer: Installation on Linux/OSX
For example:
composer require "mongodb/mongodb=^1.0.0"
Once you have it installed, you can try connecting using:
<?php
require 'vendor/autoload.php';
$collection = (new MongoDB\Client("mongodb://127.0.0.1:27017"))->dbname->coll;
?>
See also: