Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-3053

Strict Json $date not interpreted correctly

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: 1.14.6, 1.16.0
    • Component/s: CRUD
    • Labels:
      None
    • Environment:
      OSX
    • Not Needed

      This works...

      {"expirationDate" : {"$gt" : ISODate("2018-09-04T04:00:00.000Z")}}
      

      This does not...

      {"expirationDate" : {"$gt" : {$date : "2018-09-04T04:00:00.000Z"}}}
      

      Looks like $date is sent raw and is not converted to a BSON date type

      0000   02 00 00 00 45 00 00 e7 00 00 40 00 40 06 00 00
      0010   7f 00 00 01 7f 00 00 01 d4 fb 69 89 50 71 a8 63
      0020   c6 2b 88 a7 80 18 28 6f fe db 00 00 01 01 08 0a
      0030   2e 7a 72 0b 2e 7a 72 0b b3 00 00 00 02 66 69 6e
      0040   64 00 0a 00 00 00 65 6d 70 6c 6f 79 65 65 73 00
      0050   03 66 69 6c 74 65 72 00 48 00 00 00 03 65 78 70
      0060   69 72 61 74 69 6f 6e 44 61 74 65 00 33 00 00 00
      0070   03 24 67 74 00 29 00 00 00 02 24 64 61 74 65 00
      0080   19 00 00 00 32 30 31 38 2d 30 39 2d 30 34 54 30
      0090   34 3a 30 30 3a 30 30 2e 30 30 30 5a 00 00 00 00
      00a0   10 6c 69 6d 69 74 00 14 00 00 00 08 72 65 74 75
      00b0   72 6e 4b 65 79 00 00 08 73 68 6f 77 52 65 63 6f
      00c0   72 64 49 64 00 00 03 6c 73 69 64 00 1e 00 00 00
      00d0   05 69 64 00 10 00 00 00 04 21 bd a5 1b 1f 8c 48
      00e0   84 9f 86 e2 60 81 de cb 8f 00 00
      

      Mongodump works correctly with the same syntax.

      mongodump -d morphia_example -c employees -q '{"expirationDate" : {"$gt" : {$date : "2018-09-04T04:00:00.000Z"}}}'
      2018-08-09T11:44:54.068-0500	writing morphia_example.employees to
      2018-08-09T11:44:54.070-0500	done dumping morphia_example.employees (2 documents)
      

      Table:

      According to the docs here: https://docs.mongodb.com/manual/reference/mongodb-extended-json/#input-in-strict-mode Compass should correctly work with strict mode.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.arhelger@mongodb.com Kevin Arhelger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: