api/parts/mgmt/app_users

This module is meant for manipulating app_users documents programmatically, without the need of SDK request

Source:

Methods

(static) count(app_id, query, callback)

Source:

Count users by query.

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)

Source:

Create new app_user document. Creates uid if one is not provided

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)

Source:

Delete existing app_users documents, deletes also all plugin data

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)

Source:

Exports data about app_users, including plugin data

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)

Source:

Returns uid for new users

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)

Source:

Merges two app users data (including plugin data) into one user, using mostly params from latest user, and updates all collections

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)

Source:

Search for users by query. Additionally can manipulate result set as sort, limit, skip, and specify return fields

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)

Source:

Update existing app_users document. Cannot replace document, must have modifiers like $set, $unset, etc

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}

Source:

Fetch aggregated data from DB.

Parameters:
Name Type Description
collectionName string

| Name of collection

aggregation object

| Aggregation object

Returns:

| new promise

Type
object