Robomongo: Trying to validate Insert Document Fails ( new Date() )

Created on 18 Feb 2016  路  1Comment  路  Source: Studio3T/robomongo

Mac client: The below script isn't validating correctly, it claims there's something wrong with the first of my date lines. Am I missing something glaringly obvious or is there a problem with new Date()?

UPDATE: Interestingly, from that Insert record form the command fails, but if I run an update from the collection/code screen new Date() works just fine!

{
    customerAccountId: 2501,
    voiceRating: [
        {rating: 'bad', gte: 0, lt: 30},
        {rating: 'warn', gte: 30, to: 60},
        {rating: 'iffy', gte: 60, to: 100},
        {rating: 'good', gte: 100}
    ],
    dataRating: [
        {rating: 'bad', gte: 0, lt: 10},
        {rating: 'warn', gte: 10, lt: 100},
        {rating: 'iffy', gte: 100, lt: 500},
        {rating: 'good', gte: 500}
    ],
    dateCreated: new Date(),
    dateUpdated: new Date(),
    dateStart: new Date()
}
works as designed

Most helpful comment

Hi @zeg-io! This happens because of the editor is a JSON editor and it does not execute any javascript or mongo shell functions. To make it work - you just need to put actual date value like this: ISODate("2016-02-18T00:00:00.000Z")

>All comments

Hi @zeg-io! This happens because of the editor is a JSON editor and it does not execute any javascript or mongo shell functions. To make it work - you just need to put actual date value like this: ISODate("2016-02-18T00:00:00.000Z")

Was this page helpful?
0 / 5 - 0 ratings