Tuesday 16 May 2017

Get custom graph data points from mongo collection

I am looking to create graph data points for users with role "student" converted into role "teacher" against which date range.

My Mongo collection is as below :-

{
    "name":"John",
    "role":"student",
    "created_at": "2017-03-04T14:37:42.353Z"
},
{
    "name":"Smith",
    "role":"student",
    "created_at": "2017-04-04T14:37:42.353Z"
},
{
    "name":"devial",
    "role":"student",
    "created_at": "2017-03-15T14:37:42.353Z"
},
{
    "name":"John",
    "role":"student",
    "created_at": "2017-03-04T14:37:42.353Z",
    "new_role":"teacher",
    "become_teacher_datetime":"2017-04-04T14:37:42.353Z"
},
{
    "name":"devial",
    "role":"student",
    "created_at": "2017-03-14T14:37:42.353Z",
    "new_role":"teacher",
    "become_teacher_datetime":"2017-03-16T14:37:42.353Z"
}

I am basically looking for some graph which shows , say Within this week or within any month or within any quarter ,there were X students and Y teachers.

Please guide me.

Thank you.



via BeingExpert

No comments:

Post a Comment