I am trying to get the data that I inserted into mongodb through pymongo.
My embed code below (after parsing through regex)
if connection is not None: db.model.insert({"time": datetime.datetime(int(int3), int(int1), int(int2), int(int4), int(int5), int(int6), int(int7))})
Then I introduced two data points into the shell.
>>> start = datetime.datetime(2012, 2, 2, 6, 35, 6, 764) >>> end = datetime.datetime(2012, 2, 2, 6, 55, 3, 381)
Then I tried to query the data range between these two data points and got a return.
>>> db.wing_model.find({'time': {'$gte': start, '$lt': end}}) <pymongo.cursor.Cursor object at 0x0301CFD0> >>> db.wing_model.find({'time': {'$gte': start, '$lt': end}}) <pymongo.cursor.Cursor object at 0x0301C110>
The data is listed below.
[02/02/2012 06:32:07.334][INFO] [02/02/2012 06:32:07.334][INFO] [02/02/2012 06:32:07.334][INFO] [02/02/2012 06:32:13.711][INFO] [02/02/2012 06:32:13.711][INFO] [02/02/2012 06:32:13.711][INFO] [02/02/2012 06:32:22.473][INFO] [02/02/2012 06:32:22.473][INFO] [02/02/2012 06:32:22.473][INFO] [02/02/2012 06:35:06.764][INFO] [02/02/2012 06:35:06.765][INFO] [02/02/2012 06:35:06.765][INFO] [02/02/2012 06:54:52.008][INFO] [02/02/2012 06:54:52.008][INFO] [02/02/2012 06:54:52.008][INFO] [02/02/2012 06:54:59.512][INFO] [02/02/2012 06:54:59.512][INFO] [02/02/2012 06:54:59.512][INFO] [02/02/2012 06:55:03.381][INFO] [02/02/2012 06:55:03.381][INFO] [02/02/2012 06:55:03.381][INFO] [02/02/2012 06:55:06.142][INFO] [02/02/2012 06:55:06.142][INFO] [02/02/2012 06:55:06.142][INFO] [02/02/2012 06:55:09.652][INFO] [02/02/2012 06:55:09.652][INFO] [02/02/2012 06:55:09.652][INFO] [02/02/2012 06:55:13.396][INFO] [02/02/2012 06:55:13.396][INFO]
How do I get my request to return everything between the "start" and "end" data?
Also, how can I get this in an understandable way?
Finally, why does the same query return different locations of the cursor object?
Thanks.