I have tried to add the element inside JSON. When I take the data into variable and try to add, I am able to. But, When I try to do the same operation inside the MongoDB find function, Its not working. This question is continuation to this
app.get ("/structures", function(req, res){
    if(req.query.type=="things"){
    mongoOp.thingsSt.find({},'-_id uuid devices', function(err, data) {
      var entityID=[];
      for (var i =0; i<data.length; i++){
         data[i].entityID = "1234";
         console.log(data);
       }
            res.send(data);
});
Data:
[ { devices: { dID: 'TLSM01', deviceList: [Object] },
    uuid: 'e863c776-f939-4761-bbce-bf0501b42ef7' },
  { devices: { dID: 'TLSM01', deviceList: [Object] },
    uuid: '5a0cd70d-891d-48d8-b205-e92e828ac445' } ]
Expected Output:
[ { devices: { dID: 'TLSM01', deviceList: [Object] },                                                                                                                                                                      
    uuid: 'e863c776-f939-4761-bbce-bf0501b42ef7',                                                                                                                                                                          
    entityID: '1234' },                                                                                                                                                                                                    
  { devices: { dID: 'TLSM01', deviceList: [Object] },                                                                                                                                                                      
    uuid: '5a0cd70d-891d-48d8-b205-e92e828ac445',                                                                                                                                                                          
    entityID: '1234' } ] 
When I try to do it with variable holding my data, I can able to achieve
var data = [ { devices: { dID: 'TLSM01', deviceList: ["Object"] },
    uuid: 'e863c776-f939-4761-bbce-bf0501b42ef7' },
  { devices: { dID: 'TLSM01', deviceList: ["Object"] },
    uuid: '5a0cd70d-891d-48d8-b205-e92e828ac445' } ]
for (var i =0;i<data.length;i++){
    data[i].entityID = "1234"
}
console.log(data); 
     
     
    