I have an atlas cluster and I connected charts to it. I have zero experience with data visualizations (or building dashboards) and I’d like to chart the number of documents in my database over time. E.g., if in January 10 documents were created, and in February another 10 were created, then the chart should display 10 for January and 20 for February.
I know the _id field has information when the document was created, but I have no idea how to display it in the chart. So far, all I have is document count using _id in the y-axis.
What is the best way to accomplish what I’m trying to do? Is using a bar chart the best visualization to use in this situation?
Also, for some reason whenever I’m creating a chart, I get alerts saying “Query Targeting: Scanned Objects / Returned has gone above 1000”. Is there any way to stop this for happening?
What you’re trying to do is actually pretty complex, so don’t feel bad that you couldn’t figure it out - but the good news is that it is possible to do what you’re after.
Basically you need to do the following:
Since you want to treat the _id field as a date, you need to click the “…” button next to the _id field and choose Convert Type, then choose Date.
Now make sure you have a Column chart selected
Drag the _id field (which should now show as a date) onto the X axis. Keep the “Binning” toggle on and choose the binning period you want (Month is the default, and seems to be what you want).
Now also drag the _id field to the Y axis. Keep the default COUNT aggregation selected. The chart should now show the number of documents created each month.
Finally, enable the “Compare Periods” toggle and leave the deault “Cumulative Total” option selected.
I think this should give you what you want. My example is below.
You can use the exact same steps above but choose “Date of the Month” for the binning period.
Or, if you just want to know how many documents were added in the last 24 hours, you could choose a number chart, encode count(_id) in the value channel, and add a date filter to include just the last 24 hours.