Closed exneval closed 1 year ago
I don't know if this issue kind of duplicate with #471 So I've tried to stringify an object
const obj = { $lookup: { '*': [ { products: { $lookup: { '*': ['categories'], }, }, }, ], }, }; const queryString = qs.stringify(obj, { encodeValuesOnly: true }); console.log(queryString); // $lookup[*][0][products][$lookup][*][0]=categories
Then, using the stringify result to parse back to object again
const queryObject = qs.parse(queryString); console.log(JSON.stringify(queryObject, null, 2)); // { // "$lookup": { // "*": [ // { // "products": { // "$lookup": { // "*": { // "[0]": "categories" // } // } // } // } // ] // } // }
as we can see, the parsed result is not the same as original object Please kindly check it @ljharb
The issue is the depth - qs.parse(queryString, { depth: 50 }); produces the expected object, for example. The default of depth in the docs is 5.
qs.parse(queryString, { depth: 50 });
depth
I don't know if this issue kind of duplicate with #471 So I've tried to stringify an object
Then, using the stringify result to parse back to object again
as we can see, the parsed result is not the same as original object Please kindly check it @ljharb