Hi @Doug_Duncan and @Stennie_X,
Thanks for the quick reply.
I have tried the following and it worked:
scheduled_migration.aggregate([
{"$project": {"_id": 1, "user": 1, "status": "New", "old_migrationtime": None,
"new_migrationtime": "$scheduled_time"}},
{"$merge": {"into": "audit_details"}}
everything looks fine,but I want the order of the fields in the new collection audit_details to be like below:
_id:"6308bbdefcc302677837d855"
user:"akhil"
status:null
old_data:null
new_data:2022-08-30T17:58:18.551+00:00
but my new collection looks like below:
{
"_id": {
"$oid": "6308bbdefcc302677837d855"
},
"new_migrationtime": "2022-09-26 16:26:00",
"old_migrationtime": "2022-07-21 16:26:00",
"status": "modified",
"user": "xxxxx",
"last_modified": {
"$date": {
"$numberLong": "1662039075400"
}
}
}
is there any way to achieve it in the order i require