I have a JSON object with
parameters.projection = {"apples" : true}
parameters.projection = {"oranges" : true}
parameters.projection = {"lemons" : true}
I pass parameters
to another function that makes the call to mongoDB
I need to combine those three elements above into a single projection objection that looks like
projection = {"apples" : true, "oranges" : true, "lemons" : true}
I have so far
var applyParameters = function(filter){
var params = {};
for(var key in filter.projection){
//What goes here to append them?
}
return params;
};
No jquery and preferably no 3rd party libraries at all. Pure JavaScript please.