Skip to content

Change readme #1827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Laravel MongoDB
===============

[![Latest Stable Version](http://img.shields.io/github/release/jenssegers/laravel-mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb) [![Total Downloads](http://img.shields.io/packagist/dm/jenssegers/mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb) [![Build Status](http://img.shields.io/travis/jenssegers/laravel-mongodb.svg)](https://travis-ci.org/jenssegers/laravel-mongodb) [![Coverage Status](http://img.shields.io/coveralls/jenssegers/laravel-mongodb.svg)](https://coveralls.io/r/jenssegers/laravel-mongodb?branch=master) [![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.me/jenssegers)
[![Latest Stable Version](http://img.shields.io/github/release/jenssegers/laravel-mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb) [![Total Downloads](http://img.shields.io/packagist/dm/jenssegers/mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb) [![Build Status](http://img.shields.io/travis/jenssegers/laravel-mongodb.svg)](https://travis-ci.org/jenssegers/laravel-mongodb) [![Coverage Status](https://coveralls.io/repos/github/jenssegers/laravel-mongodb/badge.svg?branch=master)](https://coveralls.io/github/jenssegers/laravel-mongodb?branch=master) [![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.me/jenssegers)

An Eloquent model and Query builder with support for MongoDB, using the original Laravel API. *This library extends the original Laravel classes, so it uses exactly the same methods.*

Expand All @@ -15,7 +15,6 @@ Table of contents
* [Query Builder](#query-builder)
* [Schema](#schema)
* [Extensions](#extensions)
* [Troubleshooting](#troubleshooting)
* [Examples](#examples)

Installation
Expand Down Expand Up @@ -45,6 +44,7 @@ composer require jenssegers/mongodb
5.6.x | 3.4.x
5.7.x | 3.4.x
5.8.x | 3.5.x
6.0.x | 3.6.x

And add the service provider in `config/app.php`:

Expand Down Expand Up @@ -153,8 +153,8 @@ You can connect to multiple servers or replica sets with the following configura
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'options' => [
'replicaSet' => 'replicaSetName'
]
'replicaSet' => 'replicaSetName'
]
],
```

Expand Down Expand Up @@ -263,7 +263,7 @@ Supported operations are:
- unique
- background, sparse, expire, geospatial (MongoDB specific)

All other (unsupported) operations are implemented as dummy pass-through methods, because MongoDB does not use a predefined schema. Read more about the schema builder on http://laravel.com/docs/schema
All other (unsupported) operations are implemented as dummy pass-through methods, because MongoDB does not use a predefined schema. Read more about the schema builder on https://laravel.com/docs/6.0/migrations#tables

### Geospatial indexes

Expand Down Expand Up @@ -312,6 +312,7 @@ If you want to use MongoDB as your database backend, change the driver in `confi
'queue' => 'default',
'expire' => 60,
],
]
```

If you want to use MongoDB to handle failed jobs, change the database in `config/queue.php`:
Expand All @@ -320,7 +321,7 @@ If you want to use MongoDB to handle failed jobs, change the database in `config
'failed' => [
'database' => 'mongodb',
'table' => 'failed_jobs',
],
],
```

And add the service provider in `config/app.php`:
Expand Down Expand Up @@ -601,15 +602,15 @@ $users = User::where('location', 'geoWithin', [
[
-0.1450383,
51.5069158,
],
],
[
-0.1367563,
51.5100913,
],
],
[
-0.1270247,
51.5013233,
],
],
[
-0.1450383,
51.5069158,
Expand Down Expand Up @@ -693,7 +694,7 @@ For more information about model manipulation, check http://laravel.com/docs/elo

### Dates

Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields, you will need to manually specify them as described here: http://laravel.com/docs/eloquent#date-mutators
Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields, you will need to manually specify them as described here: https://laravel.com/docs/5.0/eloquent#date-mutators

Example:

Expand Down Expand Up @@ -770,7 +771,7 @@ class User extends Eloquent {
```


Other relations are not yet supported, but may be added in the future. Read more about these relations on http://laravel.com/docs/eloquent#relationships
Other relations are not yet supported, but may be added in the future. Read more about these relations on https://laravel.com/docs/master/eloquent-relationships

### EmbedsMany Relations

Expand Down Expand Up @@ -969,7 +970,7 @@ $cursor = DB::collection('users')->raw(function($collection)
Optional: if you don't pass a closure to the raw method, the internal MongoCollection object will be accessible:

```php
$model = User::raw()->findOne(['age' => array('$lt' => 18)]);
$model = User::raw()->findOne(['age' => ['$lt' => 18]]);
```

The internal MongoClient and MongoDB objects can be accessed like this:
Expand Down Expand Up @@ -1063,7 +1064,7 @@ You may easily cache the results of a query using the remember method:
$users = User::remember(10)->get();
```

*From: http://laravel.com/docs/queries#caching-queries*
*From: https://laravel.com/docs/4.2/queries#caching-queries*

### Query Logging

Expand All @@ -1073,4 +1074,4 @@ By default, Laravel keeps a log in memory of all queries that have been run for
DB::connection()->disableQueryLog();
```

*From: http://laravel.com/docs/database#query-logging*
*From: https://laravel.com/docs/4.2/database#query-logging*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there newer versions of this documentation? Or does the current documentation lack this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find about query logging in current version for docs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that in new version good way seems like here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenssegers , do you want change this link ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenssegers, can you answer me ?