Skip to content

Commit

Permalink
Updates into docs #6
Browse files Browse the repository at this point in the history
  • Loading branch information
gurcuff91 committed Mar 28, 2024
1 parent c2f75c4 commit d88d88b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docs/docs/documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ to generate **fields** accordingly. Attributes _without type annotations_ will b
class fields.
///

/// note
By default, Mongotoy does **not require** any field values to be specified during document creation, aligning with
MongoDB's schemaless nature. Unspecified field values are set to `mongotoy.expressions.EmptyValue`, and Mongotoy
only validates the values of fields that have been explicitly specified. The exception to this rule is the `id` field,
which must have at least one default value defined either through the `default` or `default_factory` properties.
///

### The collection name

By default, Mongotoy pluralizes the lowercase class name to determine the collection name. So, in this
Expand Down Expand Up @@ -107,22 +114,14 @@ class Address(EmbeddedDocument):
country: str
````

/// note
By default, Mongotoy does **not require** any field values to be specified during document creation, aligning with
MongoDB's schemaless nature. Unspecified field values are set to `mongotoy.expressions.EmptyValue`, and Mongotoy
only validates the values of fields that have been explicitly specified. The exception to this rule is the `id` field,
which must have at least one default value defined either through the `default` or `default_factory` properties.
///


## Dumping documents

Mongotoy simplifies the process of exporting document data by offering three distinct methods:
`dump_dict`, `dump_json`, and `dump_bson`. These three methods offer flexibility, allowing you to choose the
appropriate format based on needs and integration requirements.

/// note
The `dump_json` and `dump_bson` methods prepare data for compatibility with JSON and BSON formats respectively.
The `dump_json` and `dump_bson` methods only prepares data for compatibility with JSON and BSON formats respectively.
However, they don't perform serialization themselves, to fully serialize the data you'll need to use an
appropriate third-party library.
///
Expand Down

0 comments on commit d88d88b

Please sign in to comment.