简体   繁体   English

烧瓶 - 发动机中的聚集

[英]Aggregation in flask-mongoengine

I'm just staring out with MongoDB and I'm staring an application with flask-mongoengine and I want to aggregate a few documents. 我只是盯着MongoDB,我正在用瓶子 - mongoengine盯着一个应用程序,我想汇总一些文件。

I'm using flask-mongoengine and when trying 我正在尝试使用烧瓶 - mongoengine

class MyDocumentModel(db.Document):
  name = db.StringField(max_length=55)

MyDocumentModel.objects.aggregate()

I get the error: 我收到错误:

AttributeError: 'BaseQuerySet' object has no attribute 'aggregate' AttributeError:'BaseQuerySet'对象没有属性'aggregate'

Starting with mongoengine v0.9 (which is currently in development), you will be able to use aggregate() , like you suggested: http://docs.mongoengine.org/apireference.html#mongoengine.queryset.QuerySet.aggregate 从mongoengine v0.9开始(目前正在开发中),你可以像你建议的那样使用aggregate()http//docs.mongoengine.org/apireference.html#mongoengine.queryset.QuerySet.aggregate

Until then, you need to rely on pymongo : Flask-MongoEngine & PyMongo Aggregation Query 在此之前,你需要依赖pymongoFlask-MongoEngine和PyMongo聚合查询

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM