|
|
9 năm trước cách đây | |
|---|---|---|
| lib | 9 năm trước cách đây | |
| tests | 9 năm trước cách đây | |
| .gitignore | 10 năm trước cách đây | |
| .scrutinizer.yml | 10 năm trước cách đây | |
| .travis.yml | 9 năm trước cách đây | |
| CHANGELOG-1.0.md | 9 năm trước cách đây | |
| LICENSE | 10 năm trước cách đây | |
| README.md | 9 năm trước cách đây | |
| composer.json | 9 năm trước cách đây | |
| phpunit.xml.dist | 10 năm trước cách đây |
The Mongo PHP Adapter is a userland library designed to act as an adapter
between applications relying on ext-mongo and the new driver (ext-mongodb).
It provides the API of ext-mongo built on top of mongo-php-library, thus being compatible with PHP 7.
This library aims to provide a compatibility layer for applications that rely on on libraries using ext-mongo (e.g. Doctrine ODM) but want to migrate to PHP 7 or HHVM on which ext-mongo will not run.
You should not be using this library if you do not rely on a library using
ext-mongo. If you are starting a new project, please check out mongodb/mongodb.
This library requires you to have the mongodb extension installed, and it
conflicts with the legacy mongo extension.
The preferred method of installing this library is with Composer by running the following from your project root:
$ composer require alcaeus/mongo-php-adapter
This package declares that it provides ext-mongo; Composer only allows this
replacement to apply if composer.json or a dependency contain a requirement,
see composer/composer#2690.
Therefore, you either need to have a dependency on a package which requires
ext-mongo, such as doctrine/mongodb, in your project:
"require": {
"php": "^7.0",
"alcaeus/mongo-php-adapter": "^1.0.0",
"doctrine/mongodb": "dev-master"
}
or you need to explicitly require ext-mongo yourself in composer.json:
"require": {
"php": "^7.0",
"alcaeus/mongo-php-adapter": "^1.0.0",
"ext-mongo": "*"
}
Some methods may not throw exceptions with the same exception messages as their
counterparts in ext-mongo. Do not rely on exception messages being the same.
Methods that return a result array containing a connectionId field will always
return 0 as connection ID.
Serialization of any Mongo* objects (e.g. MongoGridFSFile, MongoCursor, etc.) will not work properly. The objects can be serialized but are not usable after unserializing them.
$cmd collection cannot be used due to an issue in the underlying driver.
To run commands, use the command
method instead of querying the virtual $cmd collection.numReturned
and server keys once the cursor has started iterating. The numReturned field
will always show the same value as the at field. The server field is lacking
authentication information.at, numReturned,
firstBatchAt and firstBatchNumReturned fields. The at and numReturned
fields always return 0 for compatibility to MongoCursor. The firstBatchAt and
firstBatchNumReturned fields will contain the same value, which is the internal
position of the iterator.