Chapter 3 IDE Space help

I tried to insert the document of the collection customers .Later i got this error.

db.customers.insertOne({_id: ObjectId("5ca4bbcea2dd94ee58162a68"),
  username: 'fmiller',
  name: 'Elizabeth Ray',
  address: '9286 Bethany Glens\nVasqueztown, CO 22939',
  birthdate: 1977-03-02T02:20:31.000Z,
  email: 'arroyocolton@gmail.com',
  active: true,
  accounts: [ 371138, 324287, 276528, 332179, 422649, 387979 ],
  tier_and_details: 
   { '0df078f33aa74a2e9696e0520c1a828a': 
      { tier: 'Bronze',
        id: '0df078f33aa74a2e9696e0520c1a828a',
        active: true,
        benefits: [ 'sports tickets' ] },
     '699456451cc24f028d2aa99d7534c219': 
      { tier: 'Bronze',
        benefits: [ '24 hour dedicated line', 'concierge services' ],
        active: true,
        id: '699456451cc24f028d2aa99d7534c219' } }})

Hi @ANGELA_CABALLERO_ARROYO,
This is not a valid date format:

It should be in the following ISO date-format:

ISODate(“1977-03-02T02:20:31.000Z”)

Therefore your command would now look like this:

db.customers.insertOne({_id: ObjectId("5ca4bbcea2dd94ee58162a68"),
  username: 'fmiller',
  name: 'Elizabeth Ray',
  address: '9286 Bethany Glens\nVasqueztown, CO 22939',
  birthdate: ISODate("1977-03-02T02:20:31.000Z"),
  email: 'arroyocolton@gmail.com',
  active: true,
  accounts: [ 371138, 324287, 276528, 332179, 422649, 387979 ],
  tier_and_details: 
   { '0df078f33aa74a2e9696e0520c1a828a': 
      { tier: 'Bronze',
        id: '0df078f33aa74a2e9696e0520c1a828a',
        active: true,
        benefits: [ 'sports tickets' ] },
     '699456451cc24f028d2aa99d7534c219': 
      { tier: 'Bronze',
        benefits: [ '24 hour dedicated line', 'concierge services' ],
        active: true,
        id: '699456451cc24f028d2aa99d7534c219' } }})

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Thank you for your help

1 Like