A
A
Alexander Buki2019-02-05 01:27:51
Mongoose
Alexander Buki, 2019-02-05 01:27:51

How to get a list of all users and other queries through mongoose?

There is a Mongo database with this schema:
let reportSchema = new Schema({
ssoid: {type: String},
ts: {type: Date},
grp: {type: String},
type: {type: String},
subtype: { type: String},
url: {type: String},
orgid: {type: String},
formid: {type: String},
code: {type: String},
ltpa: {type: String},
sudirresponse: {type: String},
ymdh: {type: String}
});
ssoid - Unique identifier of users
ts - Time (unix time)
grp - Event group
type - Event type
subtype - Event subtype
url - Address from which the event came
orgid - Organization providing the service
formid - Form identifier
ltpa - Session key (empty in this set)
sudirresponse - Response from the authorization service (empty in this set)
ymdh - Date in YYYY-MM-DD-HH format
Three queries must be executed, in the database via mongoose:
1. Display a list of users (by ssoid) and the forms they used in the last hour.
2. Display a list of users who started activity on the form and did not reach the end. For example, for grp services: guis_-47 start state start, end state send. Print at what step you stopped.
3. Make TOP - 5 most used forms.
The entries themselves look like this:

{"_id":{"$oid":"5c58af318c5faf0f20775db6"},"ssoid":"650ae77a-ffce-475d-a930-c7e345e0658c","ts":{"$date":{"$numberLong":"1499763594000"}},"grp":"guis_-47","type":"formcontroller","subtype":"send","url":"https://www.mos.ru/pgu/ru/application/guis/-47/#step_1","orgid":"guis","formid":"-47","code":"MPGU","ltpa":"","sudirresponse":"","ymdh":"2017-07-11-09","__v":{"$numberInt":"0"}}

{"_id":{"$oid":"5c58af318c5faf0f20775db7"},"ssoid":"aeadac26-3e19-438b-8e4a-a1ae754bbe41","ts":{"$date":{"$numberLong":"1499763600000"}},"grp":"guis-47","type":"bill","subtype":"prepare","url":"","orgid":"","formid":"","code":"","ltpa":"","sudirresponse":"","ymdh":"2017-07-11-09","__v":{"$numberInt":"0"}}

{"_id":{"$oid":"5c58af318c5faf0f20775db8"},"ssoid":"Unauthorized","ts":{"$date":{"$numberLong":"1499763577000"}},"grp":"gibdd_fines","type":"formcontroller","subtype":"start","url":"https://www.mos.ru/pgu/ru/application/gibdd/fines/?onsite_from=popular#step_1","orgid":"gibdd","formid":"fines","code":"MPGU","ltpa":"","sudirresponse":"","ymdh":"2017-07-11-09","__v":{"$numberInt":"0"}}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question