Skip to content
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

Merge latest #4

Merged
merged 67 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
1d2807b
:construction_worker: Travis
jenssegers Jun 18, 2018
903ebb0
Add arg PHP-VERSION in Dockerfile
Jun 26, 2018
e51fe15
Delete empty row
Jun 26, 2018
43c3800
Add build arg in docker-compose.yml
Jun 26, 2018
e2a91bb
Add changes to Dcokerfile
Jun 26, 2018
49ec04d
Separate installing vendors by composer use official image of composer
Jun 26, 2018
3bba0ac
Delete use composer image
Jun 26, 2018
d1d0675
Add default value PHP_VERSION
Jun 27, 2018
d2fe7da
Merge pull request #1553 from Smolevich/changes-in-travis-build
jenssegers Jul 22, 2018
96e1531
:whale: Provide default docker arg
jenssegers Jul 22, 2018
8f9f4c6
Fix issue using query builder first method
Aug 16, 2018
bc78c75
Merge pull request #1583 from bTokman/master
jenssegers Aug 16, 2018
d795dac
EmbedsMany respect primaryKey on association
jim5359 Nov 6, 2018
5614b78
fix typos
Rowayda-Khayri Nov 6, 2018
97fadd9
Merge pull request #1643 from Rowayda-Khayri/fix-typos
jenssegers Nov 17, 2018
25a4a87
laravel/lumen 5.7.14 compatibility
Zuken Nov 23, 2018
b69ef21
Merge pull request #1650 from Zuken/compatibility_5.7.14
jenssegers Nov 27, 2018
4c1ce51
Overrided whereIn method retrieval for relations, to force use standa…
rwlRoman Nov 28, 2018
9df6d1e
Merge pull request #1661 from Zuken/fix_where_in
jenssegers Nov 29, 2018
317369c
fix bug
reatang Dec 20, 2018
625033e
reassigned getDatabaseName method
Jan 24, 2019
fdced66
Remove dead code
simonschaufi Feb 9, 2019
08868a2
Update Model.php
filipac Feb 26, 2019
fe70309
Merge pull request #1702 from simonschaufi/patch-1
jenssegers Feb 27, 2019
4f999ba
Merge pull request #1680 from reatang/v3.3.1-bugfix
jenssegers Feb 27, 2019
ae00801
Merge pull request #1696 from emprove/master
jenssegers Feb 27, 2019
5897258
Merge pull request #1712 from graphicms/master
jenssegers Feb 27, 2019
4cdcdd2
Update supported versions
jenssegers Feb 27, 2019
55c1aa1
Require Laravel 5.8
jenssegers Feb 27, 2019
bdb15c9
Fix tests (#1724)
Smolevich Mar 12, 2019
ae7b1a9
:whale: New travis docker setup
jenssegers Mar 17, 2019
a612c5f
Update phpunit.xml (#1733)
Smolevich Mar 18, 2019
e998cd0
Add arg options for creating collections with options (#1734)
Smolevich Mar 20, 2019
4cd4317
Merge remote-tracking branch 'origin/master' into patch-2
Apr 2, 2019
fdf7f67
fix chunkById for types other than ObjectId and laravel >= 5.6.25 (#1…
halaei Apr 7, 2019
83d0b8b
Adds support for _id of binary type (#1611)
mfauveau Apr 24, 2019
eb51687
Create FUNDING.yml
jenssegers May 24, 2019
ea779ee
Update FUNDING.yml
jenssegers May 24, 2019
4ef3483
Update FUNDING.yml
jenssegers May 24, 2019
3f58809
Add hasIndex and dropIndexIfExists methods
simonschaufi Jul 29, 2019
b9cc872
Revert changes in Builder and Model for id keys, fix test for Queue (…
Smolevich Aug 1, 2019
cc66b3a
Get base query before update so that scopes are applied (#1799)
goodevilgenius Aug 1, 2019
e2a8fae
Return proper value instead of _id on QueryBuilder (#1747)
goodevilgenius Aug 1, 2019
c416f52
fix for non string id
halaei Aug 13, 2019
1430568
use env values from phpunit.xml, update database.php and queue.php (#…
Smolevich Aug 15, 2019
044290f
Change operator (-> to ::)
Aug 20, 2019
e87fa48
Merge pull request #1813 from orditeck/patch-1
jenssegers Aug 21, 2019
01ac069
Merge pull request #1806 from halaei/fix-for-non-string-id
jenssegers Aug 21, 2019
6ffda75
Merge remote-tracking branch 'upstream/master' into patch-1
simonschaufi Aug 23, 2019
e821aec
Code cleanup
simonschaufi Aug 23, 2019
c80d46d
Add hasIndex and dropIndexIfExists methods
simonschaufi Sep 6, 2019
47398ff
Merge pull request #1814 from simonschaufi/code-cleanup
jenssegers Sep 6, 2019
7eb0ad2
Merge remote-tracking branch 'upstream/master' into patch-1
simonschaufi Sep 6, 2019
7592967
:arrow_up: Support for laravel 6
jenssegers Sep 8, 2019
cf45ec6
:recycle: Make tests compatible with latest phpunit version
jenssegers Sep 8, 2019
cc00aff
:rotating_light: Linting
jenssegers Sep 8, 2019
069b233
:white_check_mark: Replace str_random usage
jenssegers Sep 8, 2019
4ae4a7c
Update src/Jenssegers/Mongodb/Relations/EmbedsMany.php
jim5359 Sep 11, 2019
f3f230a
Merge pull request #1740 from jim5359/EmbedsMany-primaryKey-fix
jenssegers Sep 12, 2019
9d7d0c7
fix filtering with operator not like issue
ahmedsayedabdelsalam Sep 13, 2019
74c4202
replcae string operation with exact match of (not like)
ahmedsayedabdelsalam Sep 13, 2019
30098cd
add test to not like oepration fix
ahmedsayedabdelsalam Sep 13, 2019
2d76d22
Merge pull request #1829 from ahmedsayedabdelsalam/master
jenssegers Sep 13, 2019
4fe82c7
Merge pull request #1790 from simonschaufi/patch-1
jenssegers Oct 3, 2019
045ebf0
fix regex demo code
denissonleal Oct 9, 2019
50e4ea0
Merge pull request #1845 from denissonleal/master
jenssegers Oct 9, 2019
6b04b05
Merge branch 'master' of https://github.com/jenssegers/laravel-mongodb
ScottSpittle Oct 11, 2019
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: jenssegers
open_collective: laravel-mongodb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ composer.lock
*.sublime-workspace
*.project
.idea/
.phpunit.result.cache
27 changes: 17 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
sudo: required
dist: trusty
language: php
php:
- "7.2"
- "7.1"
language: minimal

matrix:
include:
- name: "7.1"
env: PHP_VERSION=7.1
- name: "7.2"
env: PHP_VERSION=7.2
- name: "7.3"
env: PHP_VERSION=7.3

services:
- docker

cache:
directories:
- $HOME/.composer/cache

install:
- docker version
- sudo pip install docker-compose
- docker-compose version
- sed -i -e "s/php:cli/php:${TRAVIS_PHP_VERSION}-cli/g" Dockerfile
- cat Dockerfile
- docker-compose build
- docker-compose build --build-arg PHP_VERSION=${PHP_VERSION}
- docker-compose run --rm tests composer install --no-interaction

script:
- docker-compose up --exit-code-from php
- docker-compose run --rm tests ./vendor/bin/phpunit --coverage-clover ./clover.xml
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ composer require jenssegers/mongodb
5.4.x | 3.2.x
5.5.x | 3.3.x
5.6.x | 3.4.x
5.7.x | 3.4.x
5.8.x | 3.5.x

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

Expand All @@ -63,8 +65,10 @@ The service provider will register a mongodb database extension with the origina
For usage outside Laravel, check out the [Capsule manager](https://github.com/illuminate/database/blob/master/README.md) and add:

```php
$capsule->getDatabaseManager()->extend('mongodb', function($config)
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name)
{
$config['name'] = $name;

return new Jenssegers\Mongodb\Connection($config);
});
```
Expand Down Expand Up @@ -298,7 +302,7 @@ This service provider will slightly modify the internal DatabaseReminderReposito

### Queues

If you want to use MongoDB as your database backend, change the the driver in `config/queue.php`:
If you want to use MongoDB as your database backend, change the driver in `config/queue.php`:

```php
'connections' => [
Expand Down Expand Up @@ -480,7 +484,7 @@ User::where('name', 'Jaques')->decrement('weight', 50);
The number of updated objects is returned:

```php
$count = User->increment('age');
$count = User::increment('age');
```

You may also specify additional columns to update:
Expand Down Expand Up @@ -545,13 +549,13 @@ User::where('name', 'regex', new \MongoDB\BSON\Regex("/.*doe/i"))->get();
**NOTE:** you can also use the Laravel regexp operations. These are a bit more flexible and will automatically convert your regular expression string to a MongoDB\BSON\Regex object.

```php
User::where('name', 'regexp', '/.*doe/i'))->get();
User::where('name', 'regexp', '/.*doe/i')->get();
```

And the inverse:

```php
User::where('name', 'not regexp', '/.*doe/i'))->get();
User::where('name', 'not regexp', '/.*doe/i')->get();
```

**Type**
Expand Down Expand Up @@ -689,7 +693,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: http://laravel.com/docs/eloquent#date-mutators

Example:

Expand Down Expand Up @@ -806,7 +810,7 @@ class User extends Eloquent {
}
```

You access the embedded models through the dynamic property:
You can access the embedded models through the dynamic property:

```php
$books = User::first()->books;
Expand Down Expand Up @@ -868,7 +872,7 @@ Embedded relations will return a Collection of embedded items instead of a query

### EmbedsOne Relations

The embedsOne relation is similar to the EmbedsMany relation, but only embeds a single model.
The embedsOne relation is similar to the embedsMany relation, but only embeds a single model.

```php
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
Expand All @@ -883,7 +887,7 @@ class Book extends Eloquent {
}
```

You access the embedded models through the dynamic property:
You can access the embedded models through the dynamic property:

```php
$author = Book::first()->author;
Expand Down Expand Up @@ -1033,7 +1037,7 @@ DB::collection('items')->paginate($limit, $projections);

**Push**

Add an items to an array.
Add items to an array.

```php
DB::collection('users')->where('name', 'John')->push('items', 'boots');
Expand Down
110 changes: 59 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
{
"name": "jenssegers/mongodb",
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
"keywords": ["laravel","eloquent","mongodb","mongo","database","model","moloquent"],
"homepage": "https://github.com/jenssegers/laravel-mongodb",
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"license" : "MIT",
"require": {
"illuminate/support": "^5.6",
"illuminate/container": "^5.6",
"illuminate/database": "^5.6",
"illuminate/events": "^5.6",
"mongodb/mongodb": "^1.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^7.0",
"orchestra/testbench": "^3.1",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
"doctrine/dbal": "^2.5"
},
"autoload": {
"psr-0": {
"Jenssegers\\Mongodb": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/models",
"tests/seeds"
]
},
"suggest": {
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
},
"extra": {
"laravel": {
"providers": [
"Jenssegers\\Mongodb\\MongodbServiceProvider",
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
]
}
}
}
{
"name": "jenssegers/mongodb",
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
"keywords": [
"laravel",
"eloquent",
"mongodb",
"mongo",
"database",
"model",
"moloquent"
],
"homepage": "https://github.com/jenssegers/laravel-mongodb",
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"license": "MIT",
"require": {
"illuminate/support": "^5.8|^6.0",
"illuminate/container": "^5.8|^6.0",
"illuminate/database": "^5.8|^6.0",
"illuminate/events": "^5.8|^6.0",
"mongodb/mongodb": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^7.0|^8.0",
"orchestra/testbench": "^3.1|^4.0",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
"doctrine/dbal": "^2.5"
},
"autoload": {
"psr-0": {
"Jenssegers\\Mongodb": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/models",
"tests/seeds"
]
},
"suggest": {
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
},
"extra": {
"laravel": {
"providers": [
"Jenssegers\\Mongodb\\MongodbServiceProvider",
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
]
}
}
}
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
version: '3'

services:

php:
container_name: php
tests:
container_name: tests
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/code
working_dir: /code
command: bash -c "composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit"
depends_on:
- mysql
- mongodb
- mysql

mysql:
container_name: mysql
image: mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: unittest
Expand All @@ -28,5 +26,7 @@ services:
mongodb:
container_name: mongodb
image: mongo
ports:
- 27017:27017
logging:
driver: none
38 changes: 21 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,46 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
>
stopOnFailure="false">
<testsuites>
<testsuite name="all">
<directory>tests/</directory>
<exclude>tests/MysqlRelationsTest.php</exclude>
</testsuite>
<testsuite name="schema">
<directory>tests/SchemaTest.php</directory>
<file>tests/SchemaTest.php</file>
</testsuite>
<testsuite name="seeder">
<directory>tests/SeederTest.php</directory>
<file>tests/SeederTest.php</file>
</testsuite>
<testsuite name="cache">
<directory>tests/CacheTest.php</directory>
<file>tests/CacheTest.php</file>
</testsuite>
<testsuite name="builder">
<directory>tests/QueryBuilderTest.php</directory>
<directory>tests/QueryTest.php</directory>
<file>tests/QueryBuilderTest.php</file>
<file>tests/QueryTest.php</file>
</testsuite>
<testsuite name="model">
<directory>tests/ModelTest.php</directory>
<directory>tests/RelationsTest.php</directory>
<file>tests/ModelTest.php</file>
<file>tests/RelationsTest.php</file>
</testsuite>
<testsuite name="relations">
<directory>tests/RelationsTest.php</directory>
<directory>tests/EmbeddedRelationsTest.php</directory>
<file>tests/RelationsTest.php</file>
<file>tests/EmbeddedRelationsTest.php</file>
</testsuite>
<testsuite name="mysqlrelations">
<directory>tests/RelationsTest.php</directory>
<directory>tests/MysqlRelationsTest.php</directory>
<file>tests/RelationsTest.php</file>
</testsuite>
<testsuite name="validation">
<directory>tests/ValidationTest.php</directory>
<file>tests/ValidationTest.php</file>
</testsuite>
</testsuites>
<php>
<env name="MONGO_HOST" value="mongodb"/>
<env name="MONGO_DATABASE" value="unittest"/>
<env name="MONGO_PORT" value="27017"/>
<env name="MYSQL_HOST" value="mysql"/>
<env name="MYSQL_DATABASE" value="unittest"/>
<env name="MYSQL_USERNAME" value="root"/>
<env name="QUEUE_CONNECTION" value="database"/>
</php>
</phpunit>
Loading