Scandit.Db.BaseModel

new BaseModel()

Methods

(static) all(options?: object): Promise<Scandit.Db.BaseModel[]>

Parameters:
Name Type Attributes Default Description
options object <optional>
{}
Properties
Name Type Attributes Default Description
limit integer <optional>
1000

Max number of objects to return (max: 5000).

skip integer <optional>
0

Number of objects to skip.

Returns:
Promise<Scandit.Db.BaseModel[]>

Promise which is resolved to the array of model instances.

(static) count(query: Scandit.Db.Query): Promise<integer>

Parameters:
Name Type Description
query Scandit.Db.Query

database query

Returns:
Promise<integer>

Promise which is resolved to the result of the count.

(static) find(query: Scandit.Db.Query, options?: object): Promise<Scandit.Db.BaseModel[]>

Parameters:
Name Type Attributes Default Description
query Scandit.Db.Query

database query

options object <optional>
{}
Properties
Name Type Attributes Default Description
limit integer <optional>
1000

Max number of objects to return.

skip integer <optional>
0

Number of objects to skip.

Returns:
Promise<Scandit.Db.BaseModel[]>

Promise which is resolved to the array of model instances.

(static) get(id: string): Promise<Scandit.Db.BaseModel>

Parameters:
Name Type Description
id string

Object id

Returns:
Promise<Scandit.Db.BaseModel>

Promise which is resolved to the model instance or fails if it doesn't exist.

delete(): Promise

Returns:
Promise

Promise which is resolved after successful object removal.

save(): Promise

Returns:
Promise

Promise which is resolved after object is successfully saved.