更新时间:2023-08-27 12:25:10
对于示例,您可以使用点符号并运行以下查询:
You can use the dot notation and run following query for your example:
{"parts.0":{"$gte":1},"parts.1":{"$gte":5}}
或使用下面的JS代码构建更通用的内容:
or use below JS code to build something more generic:
let input = [1,5];
let query = Object.fromEntries(input.map((val, i) => ([ "parts." + i, { $gte: val } ])));
console.log(query);