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

ISODate from object key in shell

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: 3.2.1
    • Component/s: Shell
    • None
    • Fully Compatible
    • ALL
    • Hide

      > var date = ISODate();
      > var o = {};
      > o[date] = true;
      > ISODate(Object.keys(o)[0]); // fails..
      > new Date(Object.keys(o)[0]); // works, and returns an ISODate

      Show
      > var date = ISODate(); > var o = {}; > o [date] = true; > ISODate(Object.keys(o) [0] ); // fails.. > new Date(Object.keys(o) [0] ); // works, and returns an ISODate
    • Platforms 12 (04/01/16)
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      I'm trying to make a unique set of ISODate's, the doc's mention ISODate being a wrapper around `new Date()`. When they're used as object keys they get converted to strings (as expected). If I try to put that string back through the constructor function the iso regex fails.. `throw Error("invalid ISO date");`.

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            estobbart Eric Stobbart
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: