I didn’t find a mongoose way. But, here is a way I did it by passing index to the object property.
var i = "1";
var obj = { ["prop"+i+"Name"]: "response" };
console.log(obj);
CLICK HERE to find out more related problems solutions.
I didn’t find a mongoose way. But, here is a way I did it by passing index to the object property.
var i = "1";
var obj = { ["prop"+i+"Name"]: "response" };
console.log(obj);
CLICK HERE to find out more related problems solutions.