Giter VIP home page Giter VIP logo

mongo-php-adapter's Introduction

Mongo PHP Adapter

Build Status Code Coverage Scrutinizer Code Quality

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 PHP7.

Goal

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.

Stability

This library is still in development and not stable enough to be used in production. In addition to the known issues outlined below, other issues or fatal errors may occur. Please use at your own risk.

Installation

This library requires you to have the mongodb extension installed and 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=^1.0.0@beta"

If your project requires a library that requires ext-mongo you need to also specify a provide option in your composer.json: "provide": { "ext-mongo": "1.6.12" }

Due to a limitation in composer you need to specify this in the root package.

Known issues

Return values and exceptions

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 objects

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.

Mongo

  • The Mongo class is deprecated and was not implemented in this library. If you are still using it please update your code to use the new classes.

MongoLog

  • The MongoLog class does not log anything because the underlying driver does not offer a method to retrieve this data.

MongoClient

  • The connect and close methods are not implemented because the underlying driver connects lazily and does not offer methods for connecting disconnecting.
  • The getConnections method is not implemented because the underlying driver does not offer a method to retrieve this data.
  • The killCursor method is not yet implemented.

MongoDB

  • The authenticate method is not supported. To connect to a database with authentication, please supply the credentials using the connection string.

MongoCollection

  • The aggregate method is not working because of a bug in the underlying library.
  • The insert, batchInsert, and save methods take the first argument by reference. While the original API does not explicitely specify by-reference arguments it does add an ID field to the objects and documents given.
  • The parallelCollectionScan method is not yet implemented.

MongoCursor

  • The explain method is not yet implemented.
  • The hasNext method is not yet implemented.
  • The info method does not reliably fill all fields in the cursor information. This includes the 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.
  • The setFlag method is not yet implemented.

MongoCommandCursor

  • The createFromDocument method is not yet implemented.
  • The info method does not reliably fill all fields in the cursor information. This includes the 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.

Types

  • Return values containing objects of the MongoDB\BSON\Javascript class cannot be converted to full MongoCode objects because there are no accessors for the code and scope properties.

mongo-php-adapter's People

Contributors

alcaeus avatar dermanomann avatar martinatsli avatar peterrehm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.