How can I convert the following SQL query for mongo:
SELECT column1 from table1
UNION
SELECT column1 from table2
I have up to 12 collections, one for each month:
data.2013.01
data.2013.02
...
...
data.2013.12
When plotting I'd like to show multiple months on graph at a time. That brings us to the question, how to create UNION in mongo.
I think the ultimate conclusion you will come to is that your schema is incorrect. Put all your objects of the same purpose and shape into a single collection. That's how to work in harmony with mongodb. Making collections by month is a mistake that will cause you endless needless battles with mongo. Once you have everything in one collection as intended, the aggregation can handle grouping by month for you as per the aggregation example of usernames ordered by join month.