Read-only string containing the name of the database collection that this document instance comes from.
If this is null, assume that this document instance does not represent any data stored in a database.
A key-value pair dictionary of any data that this document instance contains.
It's an object, and should have an _id
property if this document instance represents data stored in a database.
Read-only string containing the name of the database that this document instance comes from.
If this is null, assume that this document instance does not represent any data stored in a database.
Delete this document from the database client that it lives in.
If you're using a databaseless-document instance, this method will throw an error!
Optional
deleteReferences: booleanSimilar to deepDeleteReferences
, but you can pick one or the other. If true, all referenced documents will also delete themselves. If those referenced documents also reference additional documents, those documents are unaffected and may become orphaned.
Optional
deepDeleteReferences: booleanSimilar to deleteReferences
, but you can pick one or the other. If true, all referenced documents will also delete themselves and recursively delete any documents that they also reference.
Number of documents deleted. You'd want this to be just 1. Other functions may use this number to create a greater tally (eg. a database client's findAndDeleteMany
method).
This document instance's data, and only the data, organized onto an object. This also retrieves data from referenced documents and stores their data as a nested object within this document, too.
Object containing data from the document instance.
Static
createCreate an instance of the document's type. This does not write any data to a database.
Object containing keys of data that the document requires per its schema.
The name of the database/client that is managing this data.
The name of the collection that is using this document as a model for its data.
Optional
validateOnCreate: boolean = trueBoolean flag for whether or not a document instance created with this method should be validated ASAP. Default is true.
Define your document's properties in here!