Constructor
new ModelProxy(reference, builderopt)
Instantiates the proxy.
Name | Type | Attributes | Description |
---|---|---|---|
reference |
module:flitter-orm/src/model/Model~Model | module:flitter-orm/src/proxy/model/ModelProxy~ModelProxy | the parent reference |
|
builder |
module:flitter-orm/src/model/CursorBuilder~CursorBuilder |
<optional> |
optionally, the cursor builder to use |
- Source:
Members
builder :module:flitter-orm/src/model/CursorBuilder~CursorBuilder
The cursor builder applied by this proxy.
- Source:
reference :module:flitter-orm/src/model/Model~Model|module:flitter-orm/src/proxy/model/ModelProxy~ModelProxy
The parent reference of this proxy.
- Source:
Methods
(async, private) __collection() → {Promise.<mongodb/Collection>}
Get the collection instance for the proxy reference.
- Source:
- Type
- Promise.<mongodb/Collection>
(async) cursor(filteropt, optsopt) → {Promise.<*>}
Get a cursor for the reference, and apply the proxy's builder.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
object |
<optional> |
{} | mongodb filter options |
opts |
object |
<optional> |
{} | optional mongodb params |
- Source:
- Type
- Promise.<*>
(async) deleteMany(filteropt, optsopt) → {Promise.<void>}
Delete the set of records subject to this proxy's restrictions.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
object |
<optional> |
{} | mongodb filters to apply |
opts |
object |
<optional> |
{} | optional mongodb params |
- Source:
- Type
- Promise.<void>
(async) deleteOne(filteropt, optsopt) → {Promise.<module:flitter-orm/src/model/Model~Model>}
Delete a single record subject to this proxy's restrictions.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
object |
<optional> |
{} | mongodb filters to apply |
opts |
object |
<optional> |
{} | optional mongodb params |
- Source:
- the deleted model
- Type
- Promise.<module:flitter-orm/src/model/Model~Model>
(async) filter(ref) → {Promise.<module:flitter-orm/src/filter/Filter~Filter>}
Get a filter object whose reference is this proxy.
Name | Type | Default | Description |
---|---|---|---|
ref |
module:flitter-orm/src/model/Model | module:flitter-orm/src/proxy/model/ModelProxy | false |
- Type
- Promise.<module:flitter-orm/src/filter/Filter~Filter>
(async) find(filteropt, optsopt) → {Promise.<Array.<module:flitter-orm/src/model/Model~Model>>}
Find a set of records subject to this proxy's restrictions.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
object |
<optional> |
{} | mongodb filters to apply |
opts |
object |
<optional> |
{} | optional mongodb params |
- Source:
- Type
- Promise.<Array.<module:flitter-orm/src/model/Model~Model>>
(async) findOne(filteropt, optsopt) → {Promise.<module:flitter-orm/src/model/Model~Model>}
Find a single record subject to this proxy's restrictions.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
object |
<optional> |
{} | mongodb filters to apply |
opts |
object |
<optional> |
{} | optional mongodb params |
- Source:
- Type
- Promise.<module:flitter-orm/src/model/Model~Model>
(async) from_cursor(cursor) → {Promise.<Array.<module:flitter-orm/src/model/Model~Model>>}
Get an array of model instances from the provided cursor.
Name | Type | Description |
---|---|---|
cursor |
mongodb/cursor |
- Type
- Promise.<Array.<module:flitter-orm/src/model/Model~Model>>
limit(to) → {module:flitter-orm/src/proxy/model/LimitProxy~LimitProxy}
Limit the results to a specified number of records.
Name | Type | Description |
---|---|---|
to |
number |
sort() → {module:flitter-orm/src/proxy/model/SortProxy~SortProxy}
Sort the result set by the provided field(s).
Name | Type | Description |
---|---|---|
sorts... |
string | variable number of fields to sort |
Model.sort('+first_name', '+last_name', '-create_date')