I am trying to update a date field (say nextChargeDate) in multiple documents in a collection with another date field (say currentTermEndDate) in the same document incrementing the currentTermEndDate by 1 day.
Here's the update function I have written:
db.some_collection.updateMany(
{$or: [{_id: ObjectId('5c3e62ef2e9c4e0008f4749f')}, {_id: ObjectId('5c3e635a2e9c4e0008f47852')}, {_id: ObjectId('5c3e63a12e9c4e0008f47ab9')}]},
{
$set: { **nextChargeDate: new Date({$add: [ "currentTermEndDate", 1*24*60*60000 ]}**) }
}
)
Here's the update looks like in Mongo:
currentTermEndDate:2019-04-04 23:59:59.999
nextChargeDate:1969-12-31 18:00:00.000
It would be very helpful if someone can help with a solution to achieve the desired result which would be:
currentTermEndDate:2019-04-04 23:59:59.999
nextChargeDate:2019-04-05 23:59:59.999
Thanks in advance.