This module is meant from fetching data from db and processing and outputting
- Description:
This module is meant from fetching data from db and processing and outputting
- Source:
Members
(inner) dataObjects[undefined] :any
- Source:
Type:
- any
Methods
(static) alljobs(metric, params)
- Description:
Get all jobs grouped by job name for jobs api
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | name of the collection where to get data from |
params |
params | params object with app_id and date |
(static) fetchAllApps(params)
- Description:
Get data for old all apps api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchCollection(collection, params)
- Description:
Get collection data for specific app and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
collection |
string | collection name |
params |
params | params object |
(static) fetchCountries(params)
- Description:
Get data for countries api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchDashboard(params)
- Description:
Get data for dashboard api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchDataEventsOverview(params)
- Description:
Get events overview data for overview api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchDataTopEvents(params)
- Description:
Get top events data
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchDurations(params)
- Description:
Get durations ranges data and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchEventData(collection, params)
- Description:
Fetch specific event data and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
collection |
string | event key |
params |
params | params object |
(static) fetchEventGroupById(params) → {boolean|undefined}
- Description:
The return the event groups data by _id.
- Source:
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
params |
Object | params object Properties
|
Returns:
false on validation failure
- Type
- boolean | undefined
(static) fetchEventGroups(params)
- Description:
The return the event groups data by app_id.
- Source:
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
params |
Object | params object Properties
|
(static) fetchEvents(params) → {void}
- Description:
Get events data for events pi output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
Returns:
void
- Type
- void
(static) fetchFrequency(params)
- Description:
Get frequency ranges data and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchJobs(metric, params)
- Description:
Get data for jobs listing for jobs api
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | name of the collection where to get data from |
params |
params | params object with app_id and date |
(static) fetchLoyalty(params)
- Description:
Get loyalty ranges data and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchMergedEventData(params)
- Description:
Get merged data from multiple events in standard data model and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchMergedEventGroups(params)
- Description:
The return the merged event data for event groups.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
Object | params object |
(static) fetchMetric(params)
- Description:
Get metric data for metric api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchSessions(params)
- Description:
Get session data and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchTimeData(collection, params)
- Description:
Get time data for specific metric by collection and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
collection |
string | collection name |
params |
params | params object |
(static) fetchTimeObj(collection, params, isCustomEvent, optionsopt)
- Description:
Get Countly standard data model from database for segments or single level data as users, merging year and month and splitted docments together and output to browser
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collection |
string | name of the collection where to get data from |
|||||||||||||||||||||||||||||||||
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
isCustomEvent |
boolean | if value we are fetching for custom event or standard metric |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
(static) fetchTop(params)
- Description:
Get data for tops api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchTops(params)
- Description:
Get data for tops api and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
(static) fetchTotalUsersObj(metric, params)
- Description:
Get data for estimating total users count if period contains today and output to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | name of the collection where to get data from |
params |
params | params object with app_id and date |
(static) formatTotalUsersObj(obj, forMetric, prev) → {object}
- Description:
Format total users object based on propeties it has (converting short metric values to long proper ones, etc)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object | total users object |
forMetric |
string | for which metric to format result |
prev |
boolean | get data for previous period, if available |
Returns:
total users object with formated values
- Type
- object
(static) getMergedEventData(params, events, optionsopt, callback)
- Description:
Get merged data from multiple events in standard data model
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
events |
array | array with event keys |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getMergedEventGroups(params, event, optionsopt, callback)
- Description:
The return the merged event data for event groups.
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
event |
string | id of event group |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getMetric(params, metric, totalUsersMetric, callback)
- Description:
Get metric segment data from database, merging year and month and splitted docments together and breaking down data by segment
- Source:
Example
Retrieved data
[
{"_id":"Cricket Communications","t":37,"n":21,"u":34},
{"_id":"Tele2","t":32,"n":19,"u":31},
{"_id":"\tAt&t","t":32,"n":20,"u":31},
{"_id":"O2","t":26,"n":19,"u":26},
{"_id":"Metro Pcs","t":28,"n":13,"u":26},
{"_id":"Turkcell","t":23,"n":11,"u":23},
{"_id":"Telus","t":22,"n":15,"u":22},
{"_id":"Rogers Wireless","t":21,"n":13,"u":21},
{"_id":"Verizon","t":21,"n":11,"u":21},
{"_id":"Sprint","t":21,"n":11,"u":20},
{"_id":"Vodafone","t":22,"n":12,"u":19},
{"_id":"Orange","t":18,"n":12,"u":18},
{"_id":"T-mobile","t":17,"n":9,"u":17},
{"_id":"Bell Canada","t":12,"n":6,"u":12}
]
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object with app_id and date |
metric |
string | name of the collection where to get data from |
totalUsersMetric |
object | data from total users api request to correct unique user values |
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getMetricWithOptions(params, metric, totalUsersMetric, fetchTimeOptionsopt, callback)
- Description:
Get metric segment data from database with options, merging year and month and splitted docments together and breaking down data by segment
- Source:
Example
Retrieved data
[
{"_id":"Cricket Communications","t":37,"n":21,"u":34},
{"_id":"Tele2","t":32,"n":19,"u":31},
{"_id":"\tAt&t","t":32,"n":20,"u":31},
{"_id":"O2","t":26,"n":19,"u":26},
{"_id":"Metro Pcs","t":28,"n":13,"u":26},
{"_id":"Turkcell","t":23,"n":11,"u":23},
{"_id":"Telus","t":22,"n":15,"u":22},
{"_id":"Rogers Wireless","t":21,"n":13,"u":21},
{"_id":"Verizon","t":21,"n":11,"u":21},
{"_id":"Sprint","t":21,"n":11,"u":20},
{"_id":"Vodafone","t":22,"n":12,"u":19},
{"_id":"Orange","t":18,"n":12,"u":18},
{"_id":"T-mobile","t":17,"n":9,"u":17},
{"_id":"Bell Canada","t":12,"n":6,"u":12}
]
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
metric |
string | name of the collection where to get data from |
|||||||||||||||||||||||||||||||||
totalUsersMetric |
object | data from total users api request to correct unique user values |
|||||||||||||||||||||||||||||||||
fetchTimeOptions |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getPeriodObj(coll, params)
- Description:
Get period and out it to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
coll |
string | collection, this is not used, but more for compliance with validation functions |
params |
params | params object |
(static) getTimeObj(collection, params, optionsopt, callback)
- Description:
Get Countly standard data model from database for segments or single level data as users, merging year and month and splitted docments together
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collection |
string | name of the collection where to get data from |
|||||||||||||||||||||||||||||||||
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getTimeObjForEvents(collection, params, optionsopt, callback)
- Description:
Get Countly standard data model from database for events, merging year and month and splitted docments together
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collection |
string | name of the collection where to get data from |
|||||||||||||||||||||||||||||||||
params |
params | params object with app_id and date |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getTotalUsersObj(metric, params, callback)
- Description:
Get data for estimating total users count if period contains today
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | name of the collection where to get data from |
params |
params | params object with app_id and date |
callback |
function | callback to retrieve the data, receiving only one param which is output |
(static) getTotalUsersObjWithOptions(metric, params, optionsopt, callback) → {void}
- Description:
Get data for estimating total users count allowing plugins to add their own data
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
metric |
string | name of the collection where to get data from |
|||||||||
params |
params | params object with app_id and date |
|||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||
callback |
function | callback to retrieve the data, receiving only one param which is output |
Returns:
void
- Type
- void
(static) jobDetails(metric, params)
- Description:
Get all documents for a given job name
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | name of the collection where to get data from |
params |
params | params object with app_id and date |
(static) metricToCollection(metric) → {Array}
- Description:
Get collection and metric name from metric string
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
metric |
string | metric/segment name |
Returns:
array with collection, metric, model object
- Type
- Array
(static) prefetchEventData(collection, params)
- Description:
Prefetch event data, either by provided key or first event in the list and output result to browser
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
collection |
string | event key |
params |
params | params object |
(inner) fetchData(params, allMetrics, metric, cb)
- Description:
Fetch data for tops
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
allMetrics |
Array | All metrics array |
metric |
String | metric to fetch data for |
cb |
function | callback function |
(inner) fetchTimeObj(collection, params, isCustomEvent, optionsopt, callback)
- Description:
Fetch db data in standard format
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
collection |
string | from which collection to fetch |
|||||||||||||||||||||||||||||||||
params |
params | params object |
|||||||||||||||||||||||||||||||||
isCustomEvent |
boolean | if we are fetching custom event or not |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
additional optional settings Properties
|
||||||||||||||||||||||||||||||||
callback |
function | to call when fetch done |
(inner) getDataforTops(params, collection, callback)
- Description:
Calls aggregation query to calculate top three values based on 't' in given collection
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
params |
params | params object |
collection |
string | collection name |
callback |
function | callback function |
(inner) isMergeableKey(source, key) → {boolean}
- Description:
Whether a key produced by for...in over a stored document may be walked into a merge target. A field literally named proto (or constructor / prototype) deserializes as an own enumerable property, but indexing the target with it resolves to the target's prototype rather than an own slot, so assigning through it writes into Object.prototype for the life of the worker. Inherited keys are skipped for the same reason.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
source |
object | the object being iterated |
key |
string | the key for...in produced |
Returns:
true when the key is safe to merge
- Type
- boolean
(inner) union(x, y) → {array}
- Description:
Returns the union of two arrays
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
x |
array | array 1 |
y |
array | array 2 |
Returns:
merged array
- Type
- array