Question

I am using Mongoengine and in one collection I have a DictField(). Documents contain entries for the DictField like -

{'load_time' : 134, 'show_time' : 126}

Now I want to find the average over load_time for the DictField(). How can I do this? The average function of mongoengine allows to average over document fields only.

Was it helpful?

Solution

Not very familiar with MongoEngine, but ... It says in the api reference that you can "use dot-notation to refer to embedded document fields"...

Will average( "yourdictfieldname.load_time" ) work for this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top