I have a collection with each document representing a virtual auction. I want to find the most common item ID for a given time period. In SQL, I’d SELECT item, COUNT(*) as count with GROUP BY item and the usual sorting and limits. Is there a mongodb equivalent to this?
I have a collection with each document representing a virtual auction. I want to
Share
MongoDB has several options here.
Each of these options will have a different syntax and a different speed.
In any of these cases, you will likely find these options relatively slow. Map / Reduce jobs are intended to be run “off-line”, generally as a “cron job” or “scheduled task”. Note that if you plan to do this a lot, you will likely want to pre-aggregate this data.