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

DOCSP-41772-export-schema #731

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jmd-mongo
Copy link
Collaborator

@jmd-mongo jmd-mongo commented Mar 18, 2025

DESCRIPTION

Compass Export Schema.

STAGING

Export Your Schema

JIRA

https://jira.mongodb.org/browse/DOCSP-41772

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Is this free of spelling errors?
  • Is this free of grammatical errors?
  • Is this free of staging / rendering issues?
  • Are all the links working?

External Review Requirements

What's expected of an external reviewer?

Copy link

netlify bot commented Mar 18, 2025

Deploy Preview for docs-compass ready!

Name Link
🔨 Latest commit fde6756
🔍 Latest deploy log https://app.netlify.com/sites/docs-compass/deploys/67ddb6be2b2597000830e824
😎 Deploy Preview https://deploy-preview-731--docs-compass.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jmd-mongo jmd-mongo force-pushed the DOCSP-41772 branch 5 times, most recently from c7be04e to 8e662ac Compare March 18, 2025 12:54
@jmd-mongo jmd-mongo changed the title DOCSP-48249-export-schema DOCSP-41772-export-schema Mar 18, 2025
@jmd-mongo jmd-mongo force-pushed the DOCSP-41772 branch 7 times, most recently from 63cf8ba to ce8320d Compare March 18, 2025 13:35

* - ``type``
- string or array
- |bson| type of this data type. For details, see the `official JSON

Choose a reason for hiding this comment

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

So this property would contain JSON schema type, not BSON type. We'll be converting BSON type to standard JSON Schema type (when possible), or referring to a relaxed extended EJSON definition when not (https://www.mongodb.com/docs/manual/reference/mongodb-extended-json).

Choose a reason for hiding this comment

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

Example simple type:

"year": {
  "type": "integer"
 }

vs

"year": {
  "bsonType": "int"
 }

Example complex type (can't be easily described via JSON type):

"_id": {
   "$ref": "#/$defs/ObjectId"
},

vs

"_id": {
  "bsonType": "objectId"
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! Updated.

docs <https://json-schema.org/draft/2020-12/json-schema-validation#name-type>`_.

* - ``required``
- string or array

Choose a reason for hiding this comment

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

Suggested change
- string or array
- array of strings

Choose a reason for hiding this comment

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

This one must be an array

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@jmd-mongo jmd-mongo requested a review from paula-stacho March 19, 2025 16:58
@paula-stacho
Copy link

@jmd-mongo The descriptions were a stretch goal and we haven't included them in the end.

Comment on lines 21 to 31
* - ``properties``
- document
- Properties for each field, such as ``type`` and ``description``.
For details, see the `official JSON docs
<https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.1>`_.

* - ``properties.<field>.type``
- string
- The data type of the ``<field>``.

* - ``properties.<field>.description``
- string
- Human-readable description of the ``<field>``.

* - ``properties.<field>.items``
- document
- Types of elements in array fields. For details, see the `official
JSON docs <https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.2>`_.

Choose a reason for hiding this comment

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

This part doesn't make sense.
Properties exist for type: object, they are an object where keys are the fields and values are subschemas (we don't need to go into details with properties.<field>.type, because in fact there can be many levels of sub-schemas). Items exist for type: array. Items are subschema.
I also need to note that this is not an exhaustive list. It might make sense to list the most common fields, but we need to highlight that we're following a the JSON Schema Draft 2020-12 specification.

Comment on lines 25 to 26
- ``true`` if a single value of this data type appears multiple
times in the corresponding field. Otherwise ``false``.

Choose a reason for hiding this comment

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

Suggested change
- ``true`` if a single value of this data type appears multiple
times in the corresponding field. Otherwise ``false``.
- ``true`` if a single value appears multiple
times in this field. Otherwise ``false``.

Comment on lines 30 to 31
- Probability that the value of the corresponding field is this
data type in a random document.

Choose a reason for hiding this comment

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

Suggested change
- Probability that the value of the corresponding field is this
data type in a random document.
- Probability that the field exists in a random document.


* - ``x-metadata.count``
- integer
- Number of documents sampled from the collection.

Choose a reason for hiding this comment

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

Suggested change
- Number of documents sampled from the collection.
- Number of documents from the sample that have this field

Choose a reason for hiding this comment

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

These descriptions fit better the level of a field type. This could still exist for mixed types, but on the field level this description fits better.

@jmd-mongo jmd-mongo force-pushed the DOCSP-41772 branch 3 times, most recently from 43b855a to b08af02 Compare March 20, 2025 19:41
Copy link
Collaborator Author

@jmd-mongo jmd-mongo left a comment

Choose a reason for hiding this comment

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

Thanks for the discussion on this one earlier, @paula-stacho! This one is ready for another look when you have time.

Thanks,
Joe

@jmd-mongo jmd-mongo force-pushed the DOCSP-41772 branch 2 times, most recently from b71b36f to cfbb26f Compare March 20, 2025 21:19
@jmd-mongo jmd-mongo requested a review from paula-stacho March 24, 2025 20:07
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.

2 participants