Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8190

find() or mapreduce query with { $date: '...' } doesn't work, only ISODate('...')

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.2.2
    • Querying
    • None
    • direct connection to both primary and secondary nodes in replica set. CentOS Unix, mongod 2.2.2.
    • ALL

    Description

      Using both Java driver 2.10.1 and the mongo shell, if I perform a find() (or a mapreduce with same initial query), if I use

      { $date: '...' }

      to specify a date value, no results are found and also the query takes a long time to complete. If I use ISODate('...') (in the shell), the query completes quickly and finds results.

      Shell transcript:

      shard1ReplSet:PRIMARY> db.engagement_events.find({t: { $gte:

      { $date: '2013-01-16T04:00:00Z' }

      } }).count()
      0
      shard1ReplSet:PRIMARY> db.engagement_events.find({t:

      { $gte: ISODate('2013-01-16T04:00:00Z') }

      }).count()
      98024

      Are ISO datetime format strings no longer supported?

      Attachments

        Activity

          People

            Unassigned Unassigned
            rthomas@squarespace.com Robin Thomas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: