[Fixed] How to add new element on JSON file MongoDB


I have a simple question and I don’t know how to formulate it clearly because my english is bad I will explain with an example:
the MongoDB object is like this :
{_id:ObjectId("606445724bd1552e94f60691"),email:"[email protected]",password:"password123"}

I want to add age for example the object will be :

{_id:ObjectId("606445724bd1552e94f60691"),email:"[email protected]",password:"password123",age:30}

just like this please help



   { _id: ObjectId("606445724bd1552e94f60691") },
   { $set: { age: 30 } }

Hopefully you don’t store passwords as clear text in your database!

Leave a Reply

(*) Required, Your email will not be published