1

I have a database named 'mycustomers' having a collection named 'customers'

Database has currently these documents

I have executed this query

db.customers.update({}, {$currentDate: {TimeStamp: {$type: "date"}}});

Why does this statement does not update all the documents in the collection?

The result is below

{
    "_id" : ObjectId("5b3504203abb335c552137b7"),
    "gender" : "male",
    "Timestamp" : ISODate("2018-06-30T11:36:14.516Z")
}

{
    "_id" : ObjectId("5b3505533abb335c552137b8"),
    "first_name" : "John",
    "gender" : "male"
}



{
    "_id" : ObjectId("5b3505533abb335c552137b9"),
    "first_name" : "Steven",
    "gender" : "male"
}




{
    "_id" : ObjectId("5b3505533abb335c552137ba"),
    "first_name" : "Lady",
    "gender" : "female"
}




{ "_id" : ObjectId("5b3732f990418e4b51b563d4") }




{ "_id" : ObjectId("5b3733d790418e4b51b563da") }
Ashh
  • 44,693
  • 14
  • 105
  • 132

0 Answers0