cursor.sort() expects a value of 1 for ascending or -1 for descending. Calling Builder::sort($field) would result in a sort with a value of 0, so default to 1.
Check for MongoClient and Mongo classes in Connection getters
Recent versions of the driver no longer use the $status property, so this method should likely be deprecated in the future. For the time being, at least check that the Connection's $mongo property exists (like isConnected() does) before accessing the public property.
This ensures that metadata is still accessible for command results, instead of limiting the returned value to the results array in the response document.
Even if the "mongo.cmd" INI option is customized, the orignal "$" character may still be used. There is no functional reason to support a customizable command character in Doctrine.
Changed to avoid calling execute() and throw BadMethodCallException immediately if the query type is not documented as returning an Iterator. If the query type should return an Iterator, we execute it and then throw UnexpectedValueException if it does not.
This can be removed in 2.0. It's currently a bit clumsy as the names for some of these types are arbitrary. It would be preferable to use constants.
This is consistent with what is already done for geoNear commands.
Builder::hint() is only useful for setting a cursor hint (not related to ODM's UnitOfWork hints), so there is no reason to track multiple calls and apply them all to the cursor in Query::prepareCursor().
Builder now initializes a much smaller array, which only contains the default type. The array structure will grow as methods are called. In turn, Query only expects the "type", "query", and possibly "newObj" fields to exist. All others are checked for existence before access. geoNear options were moved into an "options" array, which is now consistent with mapReduce and group. A subtle behavioral change is that defaults for update operations and cursor options will no longer be applied unless explicitly set by the user. This should not be a problem, as the Builder defaults were consistent with those in the driver itself.
Also renamed the option, which is set in the query array.
These are not accessed in Query unless the query type is appropriate, and the initializer methods for those query types already create the expected fields.
This makes map() as functional as mapReduce(), apart from setting the "reduce" option.
geoNear commands against 2dsphere indexes require the "spherical" option to be true, so we can infer its default based on whether or not the "near" option is GeoJSON (in both Builder and Collection).
This changes the public API for in/notIn and removes the array cast in notIn (behavior change); however, the methods are now consistent. Other methods that take a single scalar type can use casting to sanitize their input.