php - MongoDb order by to be computed value -
what mongodb sort collection 'tweets' on integer field 'points', want remove number of seconds number of points, given difference between time now, , time tweet created. order (points - time difference).
it depends therefor on time when query run. older tweets end having lower points.
could show me example of in mongodb (in php)?
mongodb not function
in sort()
command.
in fact, performing simple find objects object.a > object.b
requires use of un-indexed $where clause.
the way around right calculate field , sort on it.
so in case, have new field value of (points-time). please note if plan sort on data, want field indexed. trying sort on large number of un-indexed fields can slow.
Comments
Post a Comment