Aug-30-2022, 12:42 PM
I have created a mongodb collection in python django.The collection name is audit_details and it consists of following data
i want the output to be like below
Output:_id:630e026211cb34947c85a7a5
user:"akhil"
status:null
old_data:null
new_data:2022-08-30T17:58:18.551+00:00
_id:630e026211cb34947c85a7a6
user:"sandeep"
status:null
old_data:null
new_data:2022-08-30T17:58:18.551+00:00
now,i want the new_data value to be assigned to "old_data" and the "new_data" will take the "updated_time" value taken from API post request(I am using django restframework and the data i am sending as post request is {"action":"modify","user":"sandeep,"updated_time":"2022-08-26 16:26:00"})i want the output to be like below
Output:_id:630e026211cb34947c85a7a6
user:"sandeep"
status:modified
old_data:migration was scheduled at 2022-08-30T17:58:18.551+00:00
new_data:migration now scheduled at "2022-08-26 16:26:00"
is it possible to achieve this in mongodb?I am using mongo latest version