NedbBaseDocument

This is the core class of SuperCamo documents, used to define functionality for both documents and embedded documents.

You should never be using this in your own code. You should be using NedbDocument or NedbEmbeddedDocument and inheriting those instead.

So, what is this documentation of this class for? Well, this is where common functionality is declared. This is the "D.R.Y" source of what the NedbDocument and NedbEmbeddedDocument classes can do.

Constructor

(abstract) new NedbBaseDocument()

Author
  • BigfootDS

Methods

(async) getData(populateopt) → {Object}

Get the plain JavaScript object representation of a SuperCamo document instance.

Parameters:
NameTypeAttributesDefaultDescription
populateBoolean<optional>
true

Optional. Set this to true to return all referenced documents as objects within the parent object.

Author
  • BigfootDS
Returns:
Type: 
Object

(async, static) create(dataObj, validateOnCreateopt) → {this}

Create a new instance of the model.

Parameters:
NameTypeAttributesDefaultDescription
dataObj

An object of data matching the model's schema.

validateOnCreateBoolean<optional>
false

If you want the instance data to be validated when this function runs, set this to true. Otherwise, you have to save the instance into the database to trigger the validation step.

Author
  • BigfootDS
Returns:

An instance of the model.

Type: 
this