Using the mongocxx driver, I need to query mongodb for documents (of stock data) that fall within a certain date range.
Consider the following document format:
{
date : ISODate("2010-01-01T00:00:00Z"),
open : 12.00,
high : 13.00,
low : 11.00,
close : 12.50,
volume : 100000
}
Say I have one collection per stock, and hundreds of these documents per collection, each with a different date.
If a user supplies two dates formatted as strings (yyyy-mm-dd):
std::string start_date = "2010-01-01";
std::string end_date = "2010-02-05";
How can I query mongo to get all the files with dates between "start_date" and "end_date", (inclusive)?
Note: I am using mongodb 3.2.12, mongocxx driver version 3.0.2
Thanks,