Skip to content

Document duplicate keys behavior in BSON documents - #6009

Closed
GromNaN wants to merge 1 commit into
php:masterfrom
GromNaN:docs/mongodb-bson-duplicate-keys
Closed

GromNaN wants to merge 1 commit into
php:masterfrom
GromNaN:docs/mongodb-bson-duplicate-keys

Conversation

@GromNaN

@GromNaN GromNaN commented Oct 23, 2026

Copy link
Copy Markdown
Member

The driver does not validate duplicate keys in BSON documents. This documents how Document handles them: iteration and the JSON conversions keep every element, get() and offsetGet() return the first value, and toPHP() keeps the last value.

The existing duplicate keys warning is updated to say that this behavior is covered by tests, but applications should still avoid duplicate keys.

@GromNaN

GromNaN commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Extension docs moved to php/doc-extensions#50

@GromNaN GromNaN closed this Oct 23, 2026
@GromNaN
GromNaN deleted the docs/mongodb-bson-duplicate-keys branch October 23, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant