Skip to content

DOP-4904: Inline docs for v1.17 #97

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 477 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
477 commits
Select commit Hold shift + click to select a range
86ce1b5
Merge pull request #522
kvwalker Apr 5, 2018
bd7ac9d
Revert "Merge pull request #522"
kvwalker Apr 9, 2018
1c33eb7
PHPLIB-278: Add examples for calling methods on database, collection,…
kvwalker Apr 9, 2018
fc3379c
Merge pull request #523
kvwalker Apr 9, 2018
1793da9
PHPLIB-80: Add IndexInfo helper methods for special index type options
kvwalker Apr 3, 2018
1ddb2ed
Merge pull request #521
kvwalker Apr 10, 2018
8ece32b
Fix RST syntax for isset() link
jmikola Apr 10, 2018
a268ffe
Merge branch 'v1.1' into v1.2
jmikola Apr 10, 2018
1df2d36
Merge branch 'v1.2' into v1.3
jmikola Apr 10, 2018
9455e41
Merge branch 'v1.3'
jmikola Apr 10, 2018
619cb07
Fix titles for createIndex and createIndexes
jmikola Apr 10, 2018
eee5e59
Merge branch 'v1.1' into v1.2
jmikola Apr 10, 2018
b1fc314
Merge branch 'v1.2' into v1.3
jmikola Apr 10, 2018
6e3ef10
Merge branch 'v1.3'
jmikola Apr 10, 2018
bd6ad38
PHPLIB-226: Document ArrayAccess for Collection and DatabaseInfo
jmikola Apr 10, 2018
b1f4ff7
Merge pull request #525
jmikola Apr 10, 2018
827aba9
PHPLIB-233: Add examples for each GridFS API method
kvwalker Apr 12, 2018
f3dad05
Merge pull request #527
kvwalker Apr 19, 2018
41eb5e5
Merge branch 'v1.3'
kvwalker Apr 19, 2018
d6f0a39
PHPLIB-346: Deprecate autoIndexId option for CreateCollection
jmikola Apr 23, 2018
9ce96cb
Merge pull request #533
jmikola Apr 23, 2018
a390652
PHPLIB-339: Deprecate snapshot option
kvwalker Apr 20, 2018
08e2a8e
Merge pull request #531
kvwalker May 1, 2018
6e527ae
PHPLIB-340: Deprecate maxScan query option
kvwalker Apr 20, 2018
ee6f3be
Merge pull request #532
kvwalker May 1, 2018
ed51e12
PHPLIB-319: Added 'disableMD5' option as GridFS MD5 digest must be op…
derickr Jun 21, 2018
73bcd98
Updates due to Jeremy's review
derickr Jun 22, 2018
f7d697c
Merged pull request #541
derickr Jun 22, 2018
ca6570e
PHPLIB-354: Implement new count API
derickr Jun 21, 2018
57541f6
Merged pull request #542
derickr Jun 22, 2018
15ec9df
PHPLIB-319: Fix indentation in disableMD5 option doc snippets
jmikola Jun 22, 2018
531a56d
Merge pull request #543
jmikola Jun 22, 2018
888b85f
Fix reference to constants in Collection::watch() docs
jmikola Jun 26, 2018
5bab836
Merge pull request #547 from mongodb/1.3-watch-fulldocument
jmikola Jun 26, 2018
ddd5844
Merge branch 'v1.3'
jmikola Jun 26, 2018
f13d5db
Fix monospace formatting in watch() docs
jmikola Jun 26, 2018
c9330cd
Merge pull request #548 from mongodb/watch-backticks
jmikola Jun 26, 2018
937db49
Merge branch 'v1.3'
jmikola Jun 26, 2018
5deffbc
PHPLIB-351: Documentation for watch() methods
jmikola Jun 26, 2018
9bb624e
Merge pull request #544
jmikola Jun 26, 2018
67fb29a
Refer to extension docs for Client::startSession() options
jmikola Jun 26, 2018
970c511
Merge pull request #549
jmikola Jun 26, 2018
a139d76
Merge branch 'v1.3'
jmikola Jun 26, 2018
00e7250
PHPLIB-359: Alternatives to restricted query operators for countDocum…
jmikola Jun 27, 2018
c42c769
Merge pull request #552
jmikola Jun 27, 2018
5d9f8b4
PHPLIB-363: Remove support for server versions < 3.0
jmikola Jun 27, 2018
f1c7574
Merge pull request #553
jmikola Jun 27, 2018
beeda3e
PHPLIB-364: Deprecate count() and elaborate on count method behaviors
jmikola Jun 27, 2018
25fc3d1
Merge pull request #555
jmikola Jun 27, 2018
e002bcd
PHPLIB-341: Add LocalDateTime example to tutorial
derickr Jul 31, 2018
d11507b
Merged pull request #571
derickr Jul 31, 2018
01153b3
PHPLIB-364: Document that transactions do not allow per-op read/write…
derickr Nov 30, 2018
4ba6259
Merged pull request #596
derickr Dec 3, 2018
c56b33e
PHPLIB-407: Support startAfter change stream option
jmikola Jul 9, 2019
823d1e8
Merge pull request #637
jmikola Jul 9, 2019
0f58d6b
PHPLIB-435: Document ChangeStream::getResumeToken()
jmikola Jul 16, 2019
359fe86
Add references to Client and Database watch() methods
jmikola Jul 16, 2019
cb6efc5
Merge pull request #641
jmikola Jul 16, 2019
2844683
PHPLIB-402: Add aggregation helper to Database class
alcaeus Jul 23, 2019
a29ed4c
PHPLIB-402: Add aggregate helper to Database class
alcaeus Jul 25, 2019
a2c7e20
PHPLIB-438: Unify handling for write stages in aggregation pipelines
alcaeus Jul 23, 2019
ce36eb7
PHPLIB-438: Unify handling for write stages in aggregation pipelines
alcaeus Jul 25, 2019
caa9bf6
PHPLIB-242: Add typeMap support for distinct
alcaeus Aug 1, 2019
e548405
Merge pull request #658
alcaeus Aug 7, 2019
008236b
PHPLIB-418: Add the ability to specify a pipeline to an update command
alcaeus Aug 12, 2019
05b2e75
Merge pull request #670
alcaeus Aug 27, 2019
f771ba4
Clear value for obsolete options field
jmikola Sep 6, 2019
1569a60
Merge pull request #681
alcaeus Sep 9, 2019
641efb2
PHPLIB-468: Add documentation for with_transaction
alcaeus Sep 5, 2019
af8a9dd
Merge pull request #680
alcaeus Sep 9, 2019
31f82c1
PHPLIB-455: Add BSON class mapping to upgrade guide
alcaeus Oct 2, 2019
439848d
PHPLIB-455: Footnotes for upgrade guide BSON table
jmikola Oct 3, 2019
7421888
Merge pull request #685
jmikola Oct 3, 2019
f67aae9
Revise Collection API section in upgrade guide
jmikola Oct 3, 2019
f20b14b
Merge pull request #686
jmikola Oct 7, 2019
e68ddc5
PHPLIB-477: Deprecate CodeWScope for use within the mapReduce command
alcaeus Oct 29, 2019
1b54292
Merge pull request #690
alcaeus Oct 30, 2019
e476a44
PHPLIB-511: Document autoEncryption options in Client constructor docs
alcaeus Jan 22, 2020
94f8a12
Merge pull request #708
alcaeus Jan 23, 2020
dd59b25
PHPLIB-512: Document createClientEncryption method
alcaeus Jan 22, 2020
478f508
Merge pull request #709
alcaeus Jan 24, 2020
418fb50
PHPLIB-521: Deprecate obsolete driver options
alcaeus Jan 28, 2020
9658c7f
Merge pull request #714
alcaeus Jan 29, 2020
3bc1501
Common docs for hint option
jmikola Jan 30, 2020
bd843cf
PHPLIB-491: Support hint for update command
jmikola Jan 30, 2020
a5f2e86
Merge pull request #717
jmikola Jan 30, 2020
e35350c
PHPLIB-492: Create tutorial for client side encryption
alcaeus Jan 29, 2020
f2f391a
Merge pull request #716
alcaeus Feb 3, 2020
3e28ca9
PHPLIB-497: Allow passing hint to findAndModify update/replace ops
jmikola Jan 24, 2020
702a81c
Merge pull request #711
jmikola Feb 14, 2020
0eaabec
PHPLIB-500: Support for allowDiskUse on find operations
alcaeus Feb 7, 2020
ee53a70
Merge pull request #721
alcaeus Feb 27, 2020
091b0b0
PHPLIB-520: Document deprecation of oplogReplay find option
alcaeus Mar 24, 2020
5fad17a
Merge pull request #730
alcaeus Mar 25, 2020
69518eb
PHPLIB-516: Append PHPLIB version information to handshake data
alcaeus Mar 24, 2020
75ea95f
Merge pull request #731
alcaeus Mar 25, 2020
a33d049
PHPLIB-539: Allow hinting for delete
alcaeus Mar 30, 2020
abaccd1
Merge pull request #732
alcaeus Apr 2, 2020
afe0ea2
PHPLIB-434: Add note about performance of countDocuments
alcaeus Apr 6, 2020
c869367
Fix typo in index documentation
alcaeus Apr 6, 2020
822dfee
Merge pull request #735
alcaeus Apr 7, 2020
e303a08
PHPLIB-545: Support the authorizedDatabases options for listDatabases
alcaeus Apr 20, 2020
23be0af
Merge pull request #739
alcaeus Apr 22, 2020
e4d0720
Fix type for createCollection validator option docs
jmikola May 4, 2020
9063f5e
Merge branch 'v1.1' into v1.2
jmikola May 4, 2020
5c58b35
Merge branch 'v1.2' into v1.3
jmikola May 4, 2020
d6791c1
Merge branch 'v1.3' into v1.4
jmikola May 4, 2020
e1d476b
Merge branch 'v1.4' into v1.5
jmikola May 4, 2020
7e68119
Merge branch 'v1.5' into v1.6
jmikola May 4, 2020
c712a13
Merge branch 'v1.6' into v1.7
jmikola May 4, 2020
ef308f5
PHPLIB-544: Add commitQuorum option to createIndexes
alcaeus Apr 28, 2020
55c7306
Don't duplicate description for docs
alcaeus Apr 29, 2020
f7f31bc
Merge pull request #741
alcaeus May 11, 2020
fc7a52f
DOCSP-10188: fix yaml file preventing docs build
Jun 1, 2020
52d7f4c
Merge pull request #752
jmikola Jun 1, 2020
c9845da
PHPLIB-559: Make aggregate command explainable
alcaeus Jun 30, 2020
9477aef
Merge pull request #760
alcaeus Jul 1, 2020
45d00ef
PHPLIB-547: Implement listDatabaseNames helper
alcaeus Jun 29, 2020
e937569
PHPLIB-547: Implement listCollectionNames helper
alcaeus Jun 29, 2020
081fc24
Merge pull request #758
alcaeus Jul 7, 2020
74022f2
PHPLIB-524 Restructure docs index
jmikola Jul 9, 2020
03311dc
PHPLIB-523 Document install steps for extension
jmikola Jul 9, 2020
d6b0ae2
Fix doc syntax and formatting
jmikola Jul 9, 2020
5ec2df1
Merge pull request #764
jmikola Jul 9, 2020
6f17a63
Merge branch 'v1.1' into v1.2
jmikola Jul 9, 2020
e8d9be1
Merge branch 'v1.2' into v1.3
jmikola Jul 9, 2020
22fa33b
Merge branch 'v1.3' into v1.4
jmikola Jul 9, 2020
84d3ae1
Merge branch 'v1.4' into v1.5
jmikola Jul 9, 2020
6900290
Merge branch 'v1.5' into v1.6
jmikola Jul 9, 2020
570cfa3
Merge branch 'v1.6' into v1.7
jmikola Jul 9, 2020
86c9e3f
PHPLIB-547: Fix links to new enumeration methods
jmikola Jul 16, 2020
a9d12be
Fixed missing backslash in documentation (#794)
yosmanyga Nov 12, 2020
046403b
PHPLIB-577: Add examples for aggregation methods (#797)
alcaeus Nov 18, 2020
c41bca3
PHPLIB-598: Clean up cursor usages to account for iterator changes (#…
alcaeus Jan 20, 2021
6966d03
PHPLIB-621 Document Versioned API usage (#815)
alcaeus Mar 31, 2021
0c7e297
PHPLIB-659 Support options for time-series collections (#829)
alcaeus Jun 29, 2021
aabf150
PHPLIB-654 Remove deprecated terminology (#828)
alcaeus Jun 29, 2021
430425b
PHPLIB-675 Document new CollectionInfo methods (#841)
alcaeus Jul 13, 2021
dcd716e
PHPLIB-690 Update documentation for time series collection options (#…
alcaeus Jul 13, 2021
f97595e
Fix RST syntax for listCollections link
jmikola Jul 14, 2021
14639bb
Merge branch 'v1.1' into v1.2
jmikola Jul 14, 2021
aafd4d6
Use "array|object" instead of "document" in MapReduce docs
jmikola Jul 14, 2021
6bdcba1
Merge branch 'v1.2' into v1.3
jmikola Jul 14, 2021
a5e536a
PHPLIB-309 and PHPLIB-315: Fix docs for jsMode and verbose MapReduce …
jmikola Jul 14, 2021
6880eeb
Merge branch 'v1.3' into v1.4
jmikola Jul 14, 2021
b1033e0
Merge branch 'v1.4' into v1.5
jmikola Jul 14, 2021
4dd2d35
Merge branch 'v1.5' into v1.6
jmikola Jul 14, 2021
dc7c09b
Merge branch 'v1.6' into v1.7
jmikola Jul 14, 2021
1d9db87
Fix RST syntax for listCollections link
jmikola Jul 14, 2021
71cc03a
Merge branch 'v1.7' into v1.8
jmikola Jul 14, 2021
73bae9c
Merge branch 'v1.8' into v1.9
jmikola Jul 14, 2021
64ad932
PHPLIB-663: Document aggregate "let" option (#846)
jmikola Jul 14, 2021
383e1ab
PHPLIB-518: RenameCollection operation (#840)
tanlisu Jul 26, 2021
2b1f468
PHPLIB-706 Fix syntax error in docs example (#853)
alcaeus Aug 11, 2021
a03ddbc
Merge branch 'v1.9'
alcaeus Aug 13, 2021
b64a1f3
PHPLIB-713: Document hint option for findOneAndDelete
jmikola Aug 30, 2021
1313907
Merge branch 'v1.7' into v1.8
jmikola Aug 30, 2021
dd0ef78
Merge branch 'v1.8' into v1.9
jmikola Aug 30, 2021
d8a54af
Merge branch 'v1.9'
jmikola Aug 30, 2021
c8c49ff
PHPLIB-765: Remove links to legacy extension docs (#872)
jmikola Nov 29, 2021
ec74976
Merge branch 'v1.7' into v1.8
jmikola Nov 29, 2021
1366148
Merge branch 'v1.8' into v1.9
jmikola Nov 29, 2021
27c2b7c
Merge branch 'v1.9' into v1.10
jmikola Nov 29, 2021
d95406d
PHPLIB-721: Aggregate allowDiskUse option should be unset by default …
jmikola Nov 30, 2021
0dee625
PHPLIB-740: Support authorizedCollections option for listCollections …
jmikola Dec 30, 2021
ffc722a
PHPLIB-697: Deprecate Collection::mapReduce()
jmikola Jan 14, 2022
deab125
PHPLIB-786: Rename "Versioned API" to "Stable API" in docs (#888)
jmikola Feb 11, 2022
ecd6c34
Merge branch 'v1.9' into v1.10
jmikola Feb 11, 2022
aa25af8
Merge branch 'v1.10' into v1.11
jmikola Feb 11, 2022
52426fd
Merge branch 'v1.11'
jmikola Feb 11, 2022
89428dc
PHPLIB-795, PHPLIB-796: Remove references to pre-3.6 servers (#893)
jmikola Mar 1, 2022
963e9c1
DOCSP-20374: Migrate docs.mongodb.com to mongodb.com/docs (#903)
terakilobyte Mar 30, 2022
f35e9b0
PHPLIB-827: Use https links in documentation and comments (#907)
jmikola Mar 30, 2022
4889f73
PHPLIB-748: Support 'let' option for multiple CRUD commands (#910)
aleksandr-rudo Apr 18, 2022
c9f96d7
PHPLIB-826: Remove use of admin database in CSFLE driver doc examples
aleksandr-rudo Apr 18, 2022
dcb3190
PHPLIB-814: Change stream support for point-in-time pre and post-imag…
jmikola Apr 20, 2022
8be87b6
PHPLIB-843: Support clusteredIndex option for createCollection
jmikola May 16, 2022
463b1c3
PHPLIB-856: changeStreamPreAndPostImages create and collMod option
jmikola May 16, 2022
63f28c2
PHPLIB-810: Document behavior for estimatedDocumentCount
jmikola May 19, 2022
70b3ab6
PHPLIB-869: Support viewOn and pipeline options in createCollection h…
aleksandr-rudo Jun 6, 2022
f0cd039
PHPLIB-851: Queryable encryption support for create/drop collection h…
jmikola May 31, 2022
dac59aa
PHPLIB-749: Support comment option on command helpers (#925)
aleksandr-rudo Jun 7, 2022
9cbe36c
Fix versionadded syntax for autoEncryption driver option
jmikola Jun 7, 2022
0c771ba
PHPLIB-846: Improved change stream event visibility for C2C Replicati…
aleksandr-rudo Jul 7, 2022
04d4c56
PHPLIB-893: Automatic queryable encryption in CSFLE tutorial (#952)
jmikola Jul 14, 2022
15b7461
Fix typo in fullDocument option docs (#969)
jmikola Sep 6, 2022
078656a
PHPLIB-596: Add tutorial for connecting to MongoDB (#979)
alcaeus Sep 28, 2022
2d48dea
PHPLIB-790: Docs for common troubleshooting issues (#982)
jmikola Sep 30, 2022
2b7be07
PHPLIB-987: Add more examples (#981)
alcaeus Oct 4, 2022
2293cf9
PHPLIB-980: Make uri parameter for MongoDB\Client::__construct nullab…
alcaeus Oct 6, 2022
e4991b6
PHPLIB-601: Document upcoming typing changes (#985)
alcaeus Oct 7, 2022
61c28e0
Add Github Actions workflow to build documentation (#993)
alcaeus Oct 12, 2022
b6bc50d
PHPLIB-989: Move persistable class documentation to tutorial (#987)
alcaeus Oct 12, 2022
b8d6fec
PHPLIB-986: Split keyAltName example and link key management docs (#995)
alcaeus Oct 24, 2022
3f5a86a
PHPLIB-572: Add debugging tools (#996)
alcaeus Oct 25, 2022
8b82bda
PHPLIB-1040: Demonstrate enum handling in BSON tutorial (#1004)
jmikola Nov 22, 2022
e5411c1
PHPLIB-1046: Fix snooty errors in documentation (#1010)
alcaeus Dec 14, 2022
42ea4e7
Refer Windows users to GitHub releases instead of PECL for DLLs (#1016)
jmikola Dec 19, 2022
2104213
Merge branch 'v1.15'
jmikola Dec 19, 2022
2b46959
PHPLIB-1055: Various small documentation fixes (#1024)
jmikola Jan 9, 2023
4172b6f
Remove British English spelling in docs (#1031)
OskarStark Jan 11, 2023
8d2f8dc
Add PHP open tag to examples (#1037)
OskarStark Jan 17, 2023
c4f3e66
[Documentation] Remove the words `easily` and `simply` (#1041)
OskarStark Jan 18, 2023
6c2e5c3
[Documentation] Remove duplicate word (#1040)
OskarStark Jan 18, 2023
c4318d4
[Documentation] Spelling (#1042)
OskarStark Jan 18, 2023
0e9ae96
Remove extra slashes in method signature
jmikola Mar 21, 2023
d7045c1
PHPLIB-1095: Queryable Encryption is "Public Technical Preview" (#1053)
jmikola Apr 11, 2023
4053f4f
Merge branch 'v1.13' into v1.15
jmikola Apr 11, 2023
4580a5f
Merge branch 'v1.15'
jmikola Apr 11, 2023
c1d32ac
Update docs for encryptedFields create/drop collection option (#1054)
jmikola Apr 11, 2023
acf59ea
PHPLIB-913: Database::createEncryptedCollection() helper (#1050)
jmikola Apr 12, 2023
a72c25b
PHPLIB-1056: Add missing types in reference doc (#1076)
GromNaN May 25, 2023
3dad291
PHPLIB-1057: Deprecate method IndexInfo::isGeoHaystack() (#1085)
GromNaN Jun 13, 2023
04f41df
PHPLIB-1149: Use consistent terminology when referring to the MongoDB…
GromNaN Jun 15, 2023
3e60e8d
PHPLIB-1130: Remove preview notice for CSFLE Queryable Encryption (#1…
jmikola Jun 15, 2023
30e8378
PHPLIB-1174: Rely on Binary constructor default type (#1121)
jmikola Jun 30, 2023
ffb8946
PHPLIB-1176: Various improvements for In-Use Encryption tutorial (#1122)
jmikola Jul 10, 2023
1c6f730
PHPLIB-1192: Remove useCursor option in aggregate (#1130)
alcaeus Jul 17, 2023
3c246a6
PHPLIB-1119: Update to Psalm 5 (#1131)
alcaeus Jul 18, 2023
51d1b25
PHPLIB-1209: Add tutorial to show working with Codecs (#1154)
alcaeus Sep 15, 2023
c16f284
PHPLIB-1277: Rename "Reference" to "API Documentation" (#1188)
jmikola Oct 31, 2023
4e22f32
PHPLIB-1143: Document Atlas Search index helpers and fix aggregate "c…
jmikola Nov 9, 2023
450240b
PHPLIB-1243: Document add/remove logger functions (#1191)
jmikola Nov 9, 2023
406c33b
Fix wrong data type in codec tutorial (#1194)
alcaeus Nov 23, 2023
97fed35
PHPLIB-1275: Replace apiargs usage in docs with extracts (#1220)
jmikola Jan 22, 2024
37ed29d
PHPLIB-1275: Replace apiargs usage in docs with extracts (#1219)
jmikola Jan 22, 2024
81252cf
Merge branch 'v1.16' into v1.17
jmikola Jan 25, 2024
152bab0
PHPLIB-1321: Use correct method in createSearchIndexes() example (#1225)
jmikola Feb 1, 2024
040c2ed
DOCSP-36898: fix seealso admonition formatting (#1230)
Feb 20, 2024
629e37a
Merge branch 'v1.16' into v1.17
jmikola Feb 20, 2024
dc82858
DOCSP-37038: Fix broken links (#1233)
norareidy Feb 21, 2024
d675253
DOCSP-36027: Shorten class headings in nav (#1236)
norareidy Feb 27, 2024
e736aad
Merge branch 'v1.16' into v1.17
jmikola Feb 27, 2024
e74c0c1
DOCSP-36627: Fix double backslashes (#1239)
norareidy Mar 4, 2024
85e1396
DOCSP-36627: More backslash fixes (#1244)
norareidy Mar 4, 2024
419946f
DOCSP-36627: Additional double backslash fixes for v1.17 (#1243)
jmikola Mar 5, 2024
32c16b7
DOCSP-36898: Fix seealso syntax in CSFLE tutorial (#1265)
jmikola Mar 22, 2024
63ab20b
DOCSP-37027: Remove use of post in collection-option-collation (#1266)
jmikola Mar 25, 2024
d64897f
Fix versionadded syntax (#1269)
jmikola Mar 25, 2024
2e2ddaf
PHPLIB-1322: Document codec option for classes and operations (#1264)
jmikola Mar 25, 2024
b49d455
Merge branch 'v1.16' into 1.17-merge-up-1.16
jmikola Mar 25, 2024
88d2741
Merge v1.16 into v1.17 (#1271)
jmikola Mar 26, 2024
afa36dd
DOCSP-37027: Fix 1.16 build errors (#1290)
norareidy May 9, 2024
96908fa
DOCSP-37027: Fix 1.16 build errors (#1290) (#1297)
alcaeus May 10, 2024
a899883
DOCSP-37027: Additional 1.17 build fixes (#1301)
norareidy May 10, 2024
252b753
DOCSP-38371: Remove broken link (#1312) (#1314)
jmikola May 21, 2024
87ec375
Merge v1.16 into v1.17 (#1327)
jmikola May 23, 2024
70750a7
PHPLIB-1279: Revise driver/extension terminology (#1335)
jmikola Jun 6, 2024
42dab49
DOP-4904: Merge remote-tracking branch 'remotes/driver-repo/v1.17' in…
i80and Aug 6, 2024
b1afde1
DOP-4904: Remove git submodule
i80and Aug 6, 2024
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
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion mongo-php-library
Submodule mongo-php-library deleted from 528d2d
Empty file added source/.static/.mongodb
Empty file.
60 changes: 60 additions & 0 deletions source/examples/codecs/handling-data-types/DateTimeCodec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

use MongoDB\BSON\Document;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Codec\Codec;
use MongoDB\Codec\DecodeIfSupported;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Exception\UnsupportedValueException;

/** @template-implements Codec<Document, DateTimeImmutable> */
final class DateTimeCodec implements Codec
{
use DecodeIfSupported;
use EncodeIfSupported;

public function canDecode(mixed $value): bool
{
/* This codec inspects the BSON document to ensure it has the fields it expects, and that those fields are of
* the correct type. This is a robust approach to avoid decoding document that are not supported and would cause
* exceptions.
*
* For large documents, this can be inefficient as we're inspecting the entire document four times (once for
* each call to has() and get()). For small documents, this is not a problem.
*/
return $value instanceof Document
&& $value->has('utc') && $value->get('utc') instanceof UTCDateTime
&& $value->has('tz') && is_string($value->get('tz'));
}

public function canEncode(mixed $value): bool
{
return $value instanceof DateTimeInterface;
}

public function decode(mixed $value): DateTimeImmutable
{
if (! $this->canDecode($value)) {
throw UnsupportedValueException::invalidDecodableValue($value);
}

$timeZone = new DateTimeZone($value->get('tz'));
$dateTime = $value->get('utc')
->toDateTime()
->setTimeZone($timeZone);

return DateTimeImmutable::createFromMutable($dateTime);
}

public function encode(mixed $value): Document
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}

return Document::fromPHP([
'utc' => new UTCDateTime($value),
'tz' => $value->getTimezone()->getName(),
]);
}
}
13 changes: 13 additions & 0 deletions source/examples/codecs/handling-data-types/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use MongoDB\BSON\ObjectId;

final class Person
{
public function __construct(
public string $name,
public readonly DateTimeImmutable $createdAt = new DateTimeImmutable(),
public readonly ObjectId $id = new ObjectId(),
) {
}
}
55 changes: 55 additions & 0 deletions source/examples/codecs/handling-data-types/PersonCodec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

use MongoDB\BSON\Document;
use MongoDB\Codec\DecodeIfSupported;
use MongoDB\Codec\DocumentCodec;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Exception\UnsupportedValueException;

/** @template-implements DocumentCodec<Person> */
final class PersonCodec implements DocumentCodec
{
use DecodeIfSupported;
use EncodeIfSupported;

public function __construct(
private readonly DateTimeCodec $dateTimeCodec = new DateTimeCodec(),
) {
}

public function canDecode(mixed $value): bool
{
return $value instanceof Document && $value->has('name');
}

public function canEncode(mixed $value): bool
{
return $value instanceof Person;
}

public function decode(mixed $value): Person
{
if (! $this->canDecode($value)) {
throw UnsupportedValueException::invalidDecodableValue($value);
}

return new Person(
$value->get('name'),
$this->dateTimeCodec->decode($value->get('createdAt')),
$value->get('_id'),
);
}

public function encode(mixed $value): Document
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}

return Document::fromPHP([
'_id' => $value->id,
'name' => $value->name,
'createdAt' => $this->dateTimeCodec->encode($value->createdAt),
]);
}
}
12 changes: 12 additions & 0 deletions source/examples/codecs/handling-documents/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

use MongoDB\BSON\ObjectId;

final class Person
{
public function __construct(
public string $name,
public readonly ObjectId $id = new ObjectId(),
) {
}
}
49 changes: 49 additions & 0 deletions source/examples/codecs/handling-documents/PersonCodec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use MongoDB\BSON\Document;
use MongoDB\Codec\DecodeIfSupported;
use MongoDB\Codec\DocumentCodec;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Exception\UnsupportedValueException;

/** @template-implements DocumentCodec<Person> */
final class PersonCodec implements DocumentCodec
{
// These traits define commonly used functionality to avoid duplication
use DecodeIfSupported;
use EncodeIfSupported;

public function canDecode(mixed $value): bool
{
return $value instanceof Document && $value->has('name');
}

public function canEncode(mixed $value): bool
{
return $value instanceof Person;
}

public function decode(mixed $value): Person
{
if (! $this->canDecode($value)) {
throw UnsupportedValueException::invalidDecodableValue($value);
}

return new Person(
$value->get('name'),
$value->get('_id'),
);
}

public function encode(mixed $value): Document
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}

return Document::fromPHP([
'_id' => $value->id,
'name' => $value->name,
]);
}
}
7 changes: 7 additions & 0 deletions source/examples/codecs/handling-documents/disabling-codec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// Overrides the collection codec, falling back to the default type map
$collection->aggregate($pipeline, ['codec' => null]);

// Overrides the collection codec, using the specified type map
$collection->findOne($filter, ['typeMap' => ['root' => 'stdClass']]);
13 changes: 13 additions & 0 deletions source/examples/codecs/handling-documents/using-codec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use MongoDB\Client;

$client = new Client();
$collection = $client->selectCollection('test', 'person', [
'codec' => new PersonCodec(),
]);

$person = new Person('Jane Doe');
$collection->insertOne($person);

$person = $collection->findOne();
12 changes: 12 additions & 0 deletions source/examples/codecs/handling-embedded-documents/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

final readonly class Address
{
public function __construct(
public string $street,
public string $postCode,
public string $city,
public string $country,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

use MongoDB\BSON\Document;
use MongoDB\Codec\DecodeIfSupported;
use MongoDB\Codec\DocumentCodec;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Exception\UnsupportedValueException;

/** @template-implements DocumentCodec<Address> */
final class AddressCodec implements DocumentCodec
{
use DecodeIfSupported;
use EncodeIfSupported;

public function canDecode(mixed $value): bool
{
return $value instanceof Document
&& $value->has('street')
&& $value->has('postCode')
&& $value->has('city')
&& $value->has('country');
}

public function canEncode(mixed $value): bool
{
return $value instanceof Address;
}

public function decode(mixed $value): Address
{
if (! $this->canDecode($value)) {
throw UnsupportedValueException::invalidDecodableValue($value);
}

return new Address(
$value->get('street'),
$value->get('postCode'),
$value->get('city'),
$value->get('country'),
);
}

public function encode(mixed $value): Document
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}

return Document::fromPHP([
'street' => $value->street,
'postCode' => $value->postCode,
'city' => $value->city,
'country' => $value->country,
]);
}
}
14 changes: 14 additions & 0 deletions source/examples/codecs/handling-embedded-documents/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use MongoDB\BSON\ObjectId;

final class Person
{
public ?Address $address = null;

public function __construct(
public string $name,
public readonly ObjectId $id = new ObjectId()
) {
}
}
67 changes: 67 additions & 0 deletions source/examples/codecs/handling-embedded-documents/PersonCodec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

use MongoDB\BSON\Document;
use MongoDB\Codec\DecodeIfSupported;
use MongoDB\Codec\DocumentCodec;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Exception\UnsupportedValueException;

/** @template-implements DocumentCodec<Person> */
final class PersonCodec implements DocumentCodec
{
use DecodeIfSupported;
use EncodeIfSupported;

public function __construct(
private readonly AddressCodec $addressCodec = new AddressCodec(),
) {
}

public function canDecode(mixed $value): bool
{
return $value instanceof Document && $value->has('name');
}

public function canEncode(mixed $value): bool
{
return $value instanceof Person;
}

public function decode(mixed $value): Person
{
if (! $this->canDecode($value)) {
throw UnsupportedValueException::invalidDecodableValue($value);
}

$person = new Person(
$value->get('name'),
$value->get('_id'),
);

// Address is optional, so only decode if it exists
if ($value->has('address')) {
$person->address = $this->addressCodec->decode($value->get('address'));
}

return $person;
}

public function encode(mixed $value): Document
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}

$data = [
'_id' => $value->id,
'name' => $value->name,
];

// Don't add a null value to the document if address is not set
if ($value->address) {
$data['address'] = $this->addressCodec->encode($value->address);
}

return Document::fromPHP($data);
}
}
Loading