Skip to content

Releases: mongodb/laravel-mongodb

v2.0.0

10 Aug 09:08
Compare
Choose a tag to compare

Embedded Relations

In this new version, embedded documents are no longer saved to the parent model using an attribute with a leading underscore. If you have a relation like embedsMany('Book'), these books are now stored under $model['books'] instead of $model['_books']. This was changed to make embedded relations less confusing for new developers.

If you want to upgrade to this new version without having to change all your existing database objects, you can modify your embedded relations to use a non-default local key including the underscore:

$this->embedsMany('Book', '_books');

Additionally, working with embedded models has become a lot easier. With this release, you can use the update, save and delete methods on the embedded models directly, instead of going through the relation instance of the parent model. Example:

$user = User::create(array('name' => 'John Doe'));
$address = $user->addresses()->create(array('city' => 'New York'));

$address->city = 'Paris';
$address->save();

Embedded relations will return a Collection of embedded items instead of a query builder. To allow a more query-like behavior, embedded relations return a modified version of the Collection class with support for the following additional operations:

  • where($key, $operator, $value)
  • whereIn($key, $values) and whereNotIn($key, $values)
  • whereBetween($key, $values) and whereNotBetween($key, $values)
  • whereNull($key) and whereNotNull($key)
  • orderBy($key, $direction)
  • oldest() and latest()
  • limit($value)
  • offset($value)
  • skip($value)

This allows you to execute basic where queries on the collection results.

Embedded relations should now handle deeply nested relations a lot better. However, this does not produce optimal database queries, so use it with caution.

Model

The model class now supports keys in dot notation. This was added to fix an issue where local and/or foreign keys for relations were inside a sub-object.

Push and pull operations now also change the internal attributes of the model, opposed to only executing a query in the previous version.

Query builder

The query builder now supports projections using the project method. The array that you pass to this method will be passed to the find queries.

You can now also set a timeout value for the Cursor objects using the timeout method. This will automatically set the timeout on the Cursor result before converting it to an array of results.

Belongs to many

The belongs to many relation was updated and now automatically pushes/pulls the id's to/from the model object. This prevents duplicate ids from being stored.

Password reminders

The included ReminderServiceProvider was modified so that password reminders are saved with a MongoDate.

v1.4.3

08 Aug 12:20
Compare
Choose a tag to compare
  • Adjust connection handling for Laravel 4.2.8
  • Allows different _id types
  • Improved service provider

v1.4.2

02 Aug 10:30
Compare
Choose a tag to compare
  • Enabled logging for raw queries.
  • Added exposed attribute to expose the internal embedded documents.
  • Supports more mongodb operators.

v1.4.1

15 Jun 15:39
Compare
Choose a tag to compare
  • Tweaked _id handling, fixes #225.
  • Added more Mongo specific operators.

v1.4.0

02 Jun 08:00
Compare
Choose a tag to compare
  • Switched to Laravel 4.2, the older version is available in the 4.1 branch.
  • Includes Jenssegers\Mongodb\Eloquent\SoftDeletingTrait for soft deletion.

v1.3.2

29 May 10:31
Compare
Choose a tag to compare
  • Added associate for embedsOne.
  • Allows disabled timestamps for embedded models.
  • Fixed multiple nested 'or' queries.

v1.3.1

23 May 07:46
Compare
Choose a tag to compare
  • Adding initial port for has on hasOne and hasMany relations.
  • Fixed belongsTo and belongsToMany hybrid relations.

v1.3.0

02 May 10:56
Compare
Choose a tag to compare

v1.2.9

24 Apr 10:03
Compare
Choose a tag to compare
  • Added the delete method for embedded models

v1.2.8

18 Apr 13:58
Compare
Choose a tag to compare
  • Changes for Laravel v4.1.26