Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8392483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:31:50+00:00 2026-06-09T19:31:50+00:00

I am trying to retrieve the data I have inserted into mongodb via pymongo.

  • 0

I am trying to retrieve the data I have inserted into mongodb via pymongo.

My code for insert is below (after parsing via 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))})

I then entered two data points in the shell.

>>> start = datetime.datetime(2012, 2, 2, 6, 35, 6, 764)
>>> end = datetime.datetime(2012, 2, 2, 6, 55, 3, 381)

I then tried to query the range of data between these two data points and received what is returned.

>>> 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>

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 query to return everything between the ‘start’ and ‘end’ data?

Also, how do I receive this in an intelligible form?

Finally, why does the same query return different cursor object locations?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:31:51+00:00Added an answer on June 9, 2026 at 7:31 pm

    Repeating existing basic tutorial documentation:

    start = datetime.datetime(2012, 2, 2, 6, 35, 6, 764)
    end = datetime.datetime(2012, 2, 2, 6, 55, 3, 381)
    
    for doc in db.wing_model.find({'time': {'$gte': start, '$lt': end}}):
        print doc
    

    Finally, why does the same query return different cursor object
    locations?

    Where should that be the case?

    You see two different cursor instances which will likely return the same result set – or?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to retrieve data via AJAX. I can't seem to be
I have a model that I'm trying to retrieve an array of data from,
So, I'm trying to use Doctrine to retrieve some data. I have some basic
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I am trying to retrieve data into an xml tag from the database using
I am trying to retrieve data via an ODBC connection and put it in
I am trying to retrieve CLOB data from our Oracle database. the code is
I'm trying to retrieve data from a POST method, code as follows: -(void)postXMLFeed:(NSString *)XMLStrPost
I have been trying to join 4 tables together so I can retrieve data
I am trying to retrieve data in a JSON object (which I have validated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.