使用OPA MongoDB高级API的基本GROUP BY语句 [英] Basic GROUP BY statement using OPA MongoDB high level API
问题描述
我的问题很简单:我想使用OPAlang高级数据库API对MongoDB执行GROUP BY like语句.但我认为这是不可能的(?)
My question is quite simple: I'd like to perform a GROUP BY like statement with MongoDB using the OPAlang high level database API. But I don't think that is possible (?)
如果我确实想执行mongodb $ group操作,是否一定需要使用低级API(使用stdlib.apis.mongo吗?)
If I do want to perform a mongodb $group operation, do I necessarily need to use the low-level API (using stdlib.apis.mongo ?)
最后,我可以同时使用低级和高级API与我的MongoDB通信吗?
Finally, can I use both low-level and high-level APIs to communicate with my MongoDB ?
谢谢.
推荐答案
I am afraid that, taking into account latest published Opa compiler code, no aggregation is supported :( See the thread in Opa forum. Also note the comment of Quentin about the using both low- and high-level API-s:
您可以同时使用此[低级]库和内置的[高级]库,[...]"
"You can use this [low level] library and built-in [hight level] library together, [...]"
在此线程中,查看来自MLstate的人员的自动增量实施建议.请注意高级DB字段/next_id
的定义和初始化以及低级的读取和递增操作.
See the auto-increment implementation advices by the guys from the MLstate in this thread. Note the high level DB field /next_id
definition and initialization with low level read and increment.
这篇关于使用OPA MongoDB高级API的基本GROUP BY语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!