Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MongoDB Java驱动程序3.0-用于聚合的静态函数_Java_Mongodb_Static Methods - Fatal编程技术网

MongoDB Java驱动程序3.0-用于聚合的静态函数

MongoDB Java驱动程序3.0-用于聚合的静态函数,java,mongodb,static-methods,Java,Mongodb,Static Methods,我已经在Java中使用MongoDB 3.0有一段时间了,直到现在我才不得不使用聚合。 我现在需要这样的功能,我想知道为什么MongoDB开发人员没有像在投影、过滤器和排序中那样添加任何静态聚合功能 例如,当您要查询字段docId等于1的文档时,可以使用: Document Document=db.getCollectiontest.findnew Document$eq,new DocumentdocId,1.first; 或者,如果您已经导入了模型,这将非常棒。过滤器类: Document

我已经在Java中使用MongoDB 3.0有一段时间了,直到现在我才不得不使用聚合。 我现在需要这样的功能,我想知道为什么MongoDB开发人员没有像在投影、过滤器和排序中那样添加任何静态聚合功能

例如,当您要查询字段docId等于1的文档时,可以使用:

Document Document=db.getCollectiontest.findnew Document$eq,new DocumentdocId,1.first; 或者,如果您已经导入了模型,这将非常棒。过滤器类:

Document Document=db.getCollectiontest.findeqdocID,1.first; 但说到聚合,您只有第一个可用版本:

AggregateIterable=db.getCollectiontest.AggregateAListNew Document$match,new DocumentdocId,1; 他们没有添加诸如匹配、分组、排序、释放等静态功能,有什么特别的原因吗。?或者也许我在谷歌搜索方面太差了,以至于没有找到它


提前感谢您的解释

实际上,在深入研究之后,碰巧他们刚刚开发了这些静态函数,并且在当前版本3.1-SNAPSHOT的MongoDB Java驱动程序中,可以在com.MongoDB.client.model.Aggregates和com.MongoDB.client.model.congregators类中找到它们

还没有说3.1版本何时到期/计划发布