collection.find({foo: { $gt: "A", $lt: "Z"}});
如何在Filters的MongoDB Scala Driver DSL中编写此代码?
我知道我会写
and(gt("foo", "A"), lt("foo", "Z"))
但这等同于
collection.find({$and([{foo: {$gt: "A"}}, {foo: {$lt: "Z"}}])});
对我来说似乎不太优雅。
答案 0 :(得分:3)
驱动程序将根据您的情况合并filter子句值
select gameid, playerid,
max(count) filter (where event_desc = 'Shot') as shot,
max(count) filter (where event_desc = 'Miss') as miss,
. . .
from table_name
group by gameid, playerid;