Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-557

explain() for a date filter with a tz_aware connection fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      In [44]: client = pymongo.MongoClient('localhost', 27017, tz_aware=True)

      In [45]: db = client.test_database_2

      In [46]: db.posts.find({ 'date': {'$gte': datetime.datetime.utcnow() }}).explain()
      ---------------------------------------------------------------------------
      ValueError Traceback (most recent call last)
      <ipython-input-46-8a75f1cc6ec0> in <module>()
      ----> 1 db.posts.find({ 'date': {'$gte': datetime.datetime.utcnow() }}).explain()

      /Users/wojcikstefan/Repos/closeio/venv/lib/python2.7/site-packages/pymongo/cursor.pyc in explain(self)
      625 if c.__limit:
      626 c._limit = -abs(c._limit)
      --> 627 return c.next()
      628
      629 def hint(self, index):

      /Users/wojcikstefan/Repos/closeio/venv/lib/python2.7/site-packages/pymongo/cursor.pyc in next(self)
      812 raise StopIteration
      813 db = self.__collection.database
      --> 814 if len(self.__data) or self._refresh():
      815 if self.__manipulate:
      816 return db.fix_outgoing(self._data.popleft(),

      /Users/wojcikstefan/Repos/closeio/venv/lib/python2.7/site-packages/pymongo/cursor.pyc in _refresh(self)
      761 self.__skip, ntoreturn,
      762 self._query_spec(), self._fields,
      --> 763 self.__uuid_subtype))
      764 if not self.__id:
      765 self.__killed = True

      /Users/wojcikstefan/Repos/closeio/venv/lib/python2.7/site-packages/pymongo/cursor.pyc in __send_message(self, message)
      718 self.__as_class,
      719 self.__tz_aware,
      --> 720 self.__uuid_subtype)
      721 except AutoReconnect:
      722 # Don't send kill cursors to another server after a "not master"

      /Users/wojcikstefan/Repos/closeio/venv/lib/python2.7/site-packages/pymongo/helpers.pyc in _unpack_response(response, cursor_id, as_class, tz_aware, uuid_subtype)
      105 result["number_returned"] = struct.unpack("<i", response[16:20])[0]
      106 result["data"] = bson.decode_all(response[20:],
      --> 107 as_class, tz_aware, uuid_subtype)
      108 assert len(result["data"]) == result["number_returned"]
      109 return result

      ValueError: year is out of range

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: