{
"_id" : ObjectId("5822d0c92f136292e5e4a0cc"),
"Age" : "five",
"details" : [
{
"Name" : "abc"
}
]
}
how to add new value in existing array.As i shown below;
Desire Output:
{
"_id" : ObjectId("5822d0c92f136292e5e4a0cc"),
"Age" : "five",
"details" : [
{
"Name" : "abc"
"Name" : "xyz"
}
]
}
And with this code, i am getting this output:-
db.c1.update({"_id" : ObjectId("5822d0c92f136292e5e4a0cc")},
{$push:{"details":{"Name":"xyz"}}})
output:-
{
"_id" : ObjectId("5822d0c92f136292e5e4a0cc"),
"Age" : "five",
"details" : [
{
"Name" : "xyz"
},
{
"Name" : "abc"
}
]
}
Please help me out.Thanks in advance.