与本机pymongo相比

与本机pymongo相比

However, if you know the structure you can use EmbeddedDocument fields to get slightly better performance from mongoengine. I've run a similar but not equivalent test code in this gist and the output is:pymongo with dict took 0.12spymongo with embed took 0.12smongoengine with dict took 4.3059175412661075mongoengine with embed took 1.1639373211854682因此,您可以使mongoengine更快,但pymongo仍然要快得多.So you can make mongoengine faster but pymongo is much faster still. 更新这里pymongo界面的一个很好的捷径是使用聚合框架:A good shortcut to the pymongo interface here is to use the aggregation framework:def mongoengine_agg_doc(): return list(MyModel.objects.aggregate({"$limit":1}))[0] 这篇关于与本机pymongo相比,Mongoengine在大型文档上的运行速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-31 10:52