I am getting values returned from mongodb in docs in the below code
collection.find({"Stories._id":ObjectID(storyId)}, {"Stories.$":1}, function (e, docs) {
var results = docs;
results[0].Stories = [];
}
I am assigning the value of docs to results. Then i change one array in that results to an empty array. The problem i face is, if I change the value of results, the value of docs is also getting affected!!
How can i change value of results[0]
alone?
A simple JSFIDDLE link