Type Alias ClientBulkWriteModel<SchemaMap>

ClientBulkWriteModel<SchemaMap>: {
    [Namespace in keyof SchemaMap]: AnyClientBulkWriteModel<SchemaMap[Namespace]> & {
        namespace: Namespace;
    }
}[keyof SchemaMap]

A mapping of namespace strings to collections schemas.

Type Parameters

type MongoDBSchemas = {
'db.books': Book;
'db.authors': Author;
}

const model: ClientBulkWriteModel<MongoDBSchemas> = {
namespace: 'db.books'
name: 'insertOne',
document: { title: 'Practical MongoDB Aggregations', authorName: 3 } // error `authorName` cannot be number
};

The type of the namespace field narrows other parts of the BulkWriteModel to use the correct schema for type assertions.