I\'m trying to make this code run:
tilbud;
?>
Everytime I g
For those arriving on this page with PHP 7 installed:
The MongoCLient
class was provided by pecl install mongo
.
But pecl/mongo
is not available for php7 and deprecated in favor of pecl/mongodb
. But with pecl/mongodb
you'll need to use MongoDB\Driver\Manager instead of MongoClient (warning on page says so too).
See here for further reading.
This said, you will need an abstraction layer on top of the PHP MongoDB\Driver\Manager
. This is provided by mongodb/mongo-php-library.
You will need to refactor stuff like:
\MongoClient
to \MongoDB\Client
\MongoCollection
to \MongoDB\Collection
\MongoClient->selectDB
to \MongoDB\Client->selectDatabase
\MongoClient->listDBs
to \MongoDB\Client->listDatabases
iterator_to_array
, along with edits to how you use the resulting object\MongoCollection->getName
to \MongoDB\Collection->getCollectionName
\MongoCollection->update
to \MongoDB\Collection->updateOne
or updateMany
\MongoCollection->remove
to \MongoDB\Collection->deleteOne
\MongoCollection->batchInsert
to \MongoDB\Collection->insertMany