Module bson

Source
Expand description

This module contains the BSON schema typings used to express a validation on MongoDB like the following:

{
    "bsonType": "object",
    "required": ["_id"],
    "properties": {
        "_id": {"bsonType": "objectId"}
    }
}

type and bsonType can be used interchangeably when they both make sense (i.e. when bsonType maps onto JSON type). The main [MongodbJsonSchema] struct maps the following cases:

  1. BsonTypedJsonSchema a full BSON typed schema
  2. MultipleBsonTypedJsonSchema a full BSON typed schema with multiple types
  3. AllOfJsonSchema a list of schemas in AND
  4. AnyOfJsonSchema a list of schemas in OR
  5. OneOfJsonSchema a list of mutually exclusive schemas
  6. BsonSchema::Exists when a field exist but no validation is imposed

Structs§

AllOfJsonSchema
AnyOfJsonSchema
ArraySchema
MultipleBsonTypedJsonSchema
NumberSchema
ObjectSchema
OneOfJsonSchema
SharedSchema
StringSchema

Enums§

Additional
BsonSchema
BsonTypedJsonSchema
Bson Type representation from spec
BsonTypes
Items
Number