Skip to content

PHPLIB-1322: Document codec option for classes and operations #1264

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 4 commits into from
Mar 25, 2024

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Mar 20, 2024

@jmikola jmikola requested a review from a team as a code owner March 20, 2024 19:39
@jmikola jmikola requested a review from GromNaN March 20, 2024 19:39
@jmikola
Copy link
Member Author

jmikola commented Mar 20, 2024

@ccho-mongodb: Please add yourself as a reviewer.

@ccho-mongodb
Copy link

@jmikola I requested permissions to add myself as a reviewer.

I created a staging build with Snooty and there are several build errors that seem to be causing some of the content to be omitted.

Snooty autobuilder log

Staging site

Missing content example - codec description is blank

If you didn't see these errors when building with giza and the issue doesn't seem clear based on the log, please reach out to the Docs Platform team to get more info.

@@ -1,3 +1,11 @@
ref: bucket-option-codec
content: |
Copy link
Member Author

Choose a reason for hiding this comment

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

@ccho-mongodb: I removed use of post here and for collection-option-codec. There is still an existing use of it in collection-option-collation, but I'll fix that in a separate PR against v1.16 and attribute it to DOCSP-37027.

Copy link

@ccho-mongodb ccho-mongodb left a comment

Choose a reason for hiding this comment

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

LGTM! Added a couple questions and suggestions, but nothing blocking.

Latest:

jmikola added 4 commits March 25, 2024 11:21
The bucket-option-codec and collection-option-codec do not inherit common-option-codec since Snooty does not yet support "post" for appending to inherited content.
The :doc:`codec </tutorial/codecs>` to use for encoding or decoding documents.
This option is mutually exclusive with the ``typeMap`` option.

Defaults to the bucket's codec. Inheritance for a default ``codec`` option
Copy link
Member

Choose a reason for hiding this comment

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

This means if both the codec and the typeMap options are set in the bucket, we take the bucket. And if the codec is set to null in this method call, we use the typeMap from the Bucket?

Copy link
Member Author

Choose a reason for hiding this comment

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

This means if both the codec and the typeMap options are set in the bucket, we take the bucket codec.

Corrected what I assume is a typo.

And if the codec is set to null in this method call, we use the typeMap from the Bucket?

That is correct.

The PHPLIB docs have never discussed passing null for options. null values are typically ignored when we process options in Operation classes due to the use of isset().

If the codec option is null, the Bucket::find() and findOne() methods will still send it along to the CollectionWrapper since they use array_key_exists(); however, when it is ultimately received by the files collection's Collection::find() or findOne() method, the null value will be ignored based on the logic in Collection::inheritCodecOrTypeMap().

@jmikola jmikola merged commit 35381c3 into mongodb:v1.17 Mar 25, 2024
@jmikola jmikola deleted the 1.17-phplib-1322 branch March 25, 2024 16:19
This was referenced Mar 25, 2024
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.

3 participants