My database has 2 collections: Notes and Users. I can import a Note as a json file and see it in the database. However, the Users collection doesn't update even though the json file contains the User (creator) id. How can I update the User with the new Note id without having to do it manually?
When I import a Note to the Notes collection,
{
"title": "title",
"description": "description",
"creator": {
"$oid": "64ecfacb5b435db86dff6c16"
},
}
I want to auto update the Notes array in the User collection:
{
"_id": {
"$oid": "64ecfacb5b435db86dff6c16"
},
"name": "username",
"email": "[email protected]",
"password": "$2a$12$KAm/qGL1E0ivjWnpJSje/.vFRZ9a4cfXv8t0thMrs8PIH.JNh9MNO",
"notes": [
{
"$oid": "64fdb7fcb5eb57e21dcecfa3"
},
{
"$oid": "651868f4c644d12c8df13ea5"
},
** auto populate new note here **
],
"__v": 370
}