Currently, I am utilizing mongoDB for a data migration project where queries are written in plain JavaScript/JSON format:
queryObj = {}; // main object passed to mongodb for queries
The code snippet below is causing an error:
queryObj[inObj.row]['$eq'] = inObj.equals;
However, the following code snippet works without any issues:
queryObj[inObj.row[i]] = {};
queryObj[inObj.row]['$eq'] = inObj.equals;
Is there an easier way to create objects with multiple nested properties without explicitly defining each one as an object? Perhaps using Object.create or another built-in solution?