Merge "Enforce reverse time-order for sample return"

This commit is contained in:
Jenkins
2013-06-19 11:17:59 +00:00
committed by Gerrit Code Review
3 changed files with 53 additions and 24 deletions

View File

@@ -450,7 +450,9 @@ class Connection(base.Connection):
if limit == 0:
return
q = make_query_from_filter(sample_filter, require_meter=False)
samples = self.db.meter.find(q).limit(limit or 0)
samples = self.db.meter.find(q, limit=limit,
sort=[("timestamp", pymongo.DESCENDING)])
for s in samples:
# Remove the ObjectId generated by the database when
# the sample was inserted. It is an implementation