Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aaf3982

Browse files
authored
Merge branch '5.0' into merge-4.8-into-5.0-1724777129234
2 parents 6a8a2e3 + 457971b commit aaf3982

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+683
-590
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [5.0.0] - next
5+
6+
* **BREAKING CHANGE** Use `id` as an alias for `_id` in commands and queries for compatibility with Eloquent packages by @GromNaN in [#3040](https://github.com/mongodb/laravel-mongodb/pull/3040)
7+
48
## [4.8.0] - 2024年08月27日
59

610
* Add `Query\Builder::incrementEach()` and `decrementEach()` methods by @SmallRuralDog in [#2550](https://github.com/mongodb/laravel-mongodb/pull/2550)

‎docs/includes/auth/PersonalAccessToken.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ class PersonalAccessToken extends SanctumToken
1111

1212
protected $connection = 'mongodb';
1313
protected $table = 'personal_access_tokens';
14-
protected $primaryKey = '_id';
1514
protected $keyType = 'string';
1615
}

‎docs/includes/eloquent-models/PlanetThirdParty.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ class Planet extends CelestialBody
1010
use DocumentModel;
1111

1212
protected $fillable = ['name', 'diameter'];
13-
protected $primaryKey = '_id';
1413
protected $keyType = 'string';
1514
}

‎docs/includes/fundamentals/write-operations/WriteOperationsTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function testModelUpdateFluent(): void
162162

163163
// begin model update one fluent
164164
$concert = Concert::where(['performer' => 'Brad Mehldau'])
165-
->orderBy('_id')
165+
->orderBy('id')
166166
->first()
167167
->update(['venue' => 'Manchester Arena', 'ticketsSold' => 9543]);
168168
// end model update one fluent
@@ -370,31 +370,31 @@ public function testModelDeleteById(): void
370370

371371
$data = [
372372
[
373-
'_id' => 'CH-0401242000',
373+
'id' => 'CH-0401242000',
374374
'performer' => 'Mitsuko Uchida',
375375
'venue' => 'Carnegie Hall',
376376
'genres' => ['classical'],
377377
'ticketsSold' => 2121,
378378
'performanceDate' => new UTCDateTime(Carbon::create(2024, 4, 1, 20, 0, 0, 'EST')),
379379
],
380380
[
381-
'_id' => 'MSG-0212252000',
381+
'id' => 'MSG-0212252000',
382382
'performer' => 'Brad Mehldau',
383383
'venue' => 'Philharmonie de Paris',
384384
'genres' => [ 'jazz', 'post-bop' ],
385385
'ticketsSold' => 5745,
386386
'performanceDate' => new UTCDateTime(Carbon::create(2025, 2, 12, 20, 0, 0, 'CET')),
387387
],
388388
[
389-
'_id' => 'MSG-021222000',
389+
'id' => 'MSG-021222000',
390390
'performer' => 'Billy Joel',
391391
'venue' => 'Madison Square Garden',
392392
'genres' => [ 'rock', 'soft rock', 'pop rock' ],
393393
'ticketsSold' => 12852,
394394
'performanceDate' => new UTCDateTime(Carbon::create(2025, 2, 12, 20, 0, 0, 'CET')),
395395
],
396396
[
397-
'_id' => 'SF-06302000',
397+
'id' => 'SF-06302000',
398398
'performer' => 'The Rolling Stones',
399399
'venue' => 'Soldier Field',
400400
'genres' => [ 'rock', 'pop', 'blues' ],
@@ -478,22 +478,22 @@ public function testModelDeleteMultipleById(): void
478478
Concert::truncate();
479479
$data = [
480480
[
481-
'_id' => 3,
481+
'id' => 3,
482482
'performer' => 'Mitsuko Uchida',
483483
'venue' => 'Carnegie Hall',
484484
],
485485
[
486-
'_id' => 5,
486+
'id' => 5,
487487
'performer' => 'Brad Mehldau',
488488
'venue' => 'Philharmonie de Paris',
489489
],
490490
[
491-
'_id' => 7,
491+
'id' => 7,
492492
'performer' => 'Billy Joel',
493493
'venue' => 'Madison Square Garden',
494494
],
495495
[
496-
'_id' => 9,
496+
'id' => 9,
497497
'performer' => 'The Rolling Stones',
498498
'venue' => 'Soldier Field',
499499
],

‎docs/includes/usage-examples/DeleteOneTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testDeleteOne(): void
2727

2828
// begin-delete-one
2929
$deleted = Movie::where('title', 'Quiz Show')
30-
->orderBy('_id')
30+
->orderBy('id')
3131
->limit(1)
3232
->delete();
3333

‎docs/includes/usage-examples/FindManyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testFindMany(): void
3535

3636
// begin-find
3737
$movies = Movie::where('runtime', '>', 900)
38-
->orderBy('_id')
38+
->orderBy('id')
3939
->get();
4040
// end-find
4141

‎docs/includes/usage-examples/FindOneTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public function testFindOne(): void
2424

2525
// begin-find-one
2626
$movie = Movie::where('directors', 'Rob Reiner')
27-
->orderBy('_id')
27+
->orderBy('id')
2828
->first();
2929

3030
echo $movie->toJson();
3131
// end-find-one
3232

3333
$this->assertInstanceOf(Movie::class, $movie);
34-
$this->expectOutputRegex('/^{"_id":"[a-z0-9]{24}","title":"The Shawshank Redemption","directors":\["Frank Darabont","Rob Reiner"\]}$/');
34+
$this->expectOutputRegex('/^{"_id":"[a-z0-9]{24}","title":"The Shawshank Redemption","directors":\["Frank Darabont","Rob Reiner"\],"id":"[a-z0-9]{24}"}$/');
3535
}
3636
}

‎docs/includes/usage-examples/InsertOneTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function testInsertOne(): void
3030
// end-insert-one
3131

3232
$this->assertInstanceOf(Movie::class, $movie);
33-
$this->expectOutputRegex('/^{"title":"Marriage Story","year":2019,"runtime":136,"updated_at":".{27}","created_at":".{27}","_id":"[a-z0-9]{24}"}$/');
33+
$this->expectOutputRegex('/^{"title":"Marriage Story","year":2019,"runtime":136,"updated_at":".{27}","created_at":".{27}","id":"[a-z0-9]{24}"}$/');
3434
}
3535
}

‎docs/includes/usage-examples/UpdateOneTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testUpdateOne(): void
3030

3131
// begin-update-one
3232
$updates = Movie::where('title', 'Carol')
33-
->orderBy('_id')
33+
->orderBy('id')
3434
->first()
3535
->update([
3636
'imdb' => [

‎src/Auth/User.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ class User extends BaseUser
1111
{
1212
use DocumentModel;
1313

14-
protected $primaryKey = '_id';
1514
protected $keyType = 'string';
1615
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /