This module is meant for manipulating app_users documents programmatically, without the need of SDK request
- Description:
This module is meant for manipulating app_users documents programmatically, without the need of SDK request
- Source:
Methods
(static) count(app_id, query, callback)
- Description:
Count users by query.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
query |
object | json_string | mongodb query to select which app users to update |
callback |
function | called when finished providing error (if any) as first param and resultcount of users as second |
(static) create(app_id, doc, params, callback)
- Description:
Create new app_user document. Creates uid if one is not provided
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
doc |
object | document to insert |
params |
params | to determine who makes modification, should have member property with user who makes modification, and req for request object to determine ip address |
callback |
function | called when finished providing error (if any) as first param and insert result as second |
(static) delete(app_id, query, params, callback)
- Description:
Delete existing app_users documents, deletes also all plugin data
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
query |
object | mongodb query to select which app users to delete |
params |
params | to determine who makes modification, should have member property with user who makes modification, and req for request object to determine ip address |
callback |
function | called when finished providing error (if any) as first param and array with uids of removed users as second |
(static) export(app_id, query, params, callback)
- Description:
Exports data about app_users, including plugin data
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
query |
object | mongodb query to select which app users data to export |
params |
object | params |
callback |
function | called when finished providing error (if any) as first param and array with uids of exported users as second |
(static) getUid(app_id, callback)
- Description:
Returns uid for new users
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
callback |
function | called when finished providing error (if any) as first param and new uid as second |
(static) merge(app_id, newAppUser, new_id, old_id, new_device_id, old_device_id, callback)
- Description:
Merges two app users data (including plugin data) into one user, using mostly params from latest user, and updates all collections
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
newAppUser |
object | app_users document of new/current user |
new_id |
string | new user's _id |
old_id |
string | old user's _id |
new_device_id |
string | new user's device_id |
old_device_id |
string | old user's device_id |
callback |
function | called when finished providing error (if any) as first param and resulting merged document as second |
(static) search(app_id, query, project, sort, limit, skip, callback)
- Description:
Search for users by query. Additionally can manipulate result set as sort, limit, skip, and specify return fields
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
query |
object | json_string | mongodb query to select which app users to update |
project |
object | json_string | mongodb projection which fields to return |
sort |
object | json_string | mongodb sort object |
limit |
number | upper limit, how many users to return |
skip |
number | how many users to skip from beginning |
callback |
function | called when finished providing error (if any) as first param and result user list array as second |
(static) update(app_id, query, update, params, callback)
- Description:
Update existing app_users document. Cannot replace document, must have modifiers like $set, $unset, etc
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
app_id |
string | _id of the app |
query |
object | mongodb query to select which app users to update |
update |
object | mongodb update object |
params |
params | to determine who makes modification, should have member property with user who makes modification, and req for request object to determine ip address |
callback |
function | called when finished providing error (if any) as first param and updated user document as second |
(inner) getAggregatedAppUsers(collectionName, aggregation) → {object}
- Description:
Fetch aggregated data from DB.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
string | | Name of collection |
aggregation |
object | | Aggregation object |
Returns:
| new promise
- Type
- object