假设col
是一个集合。我想执行这样的查询:
filter1 = col.find({"field1": valueX, "field2": valueY})
现在,我真的不需要filter1
,我需要
filter2 = col.find({"field1": valueX, "field2": valueY, "field3": valueZ})
filter3 = col.find({"field1": valueX, "field2": valueY, "field4": valueW})
这当然是条件"field1": valueX, "field2": valueY
的两倍。我想做
filter2 = filter1.find({"field3": valueZ})
filter3 = filter1.find({"field4": valueW})
以优化查询。我该如何实现?