I have some documents in Mongo:
{"name" : "John", "age" : 26}
{"name" : "Paul", "age" : 34}
{"name" : "George", "age" : 36}
and another function that expects documents of the form:
{"name" : "XXX", "value" : YY}
Is it possible to rename the 'age' field to 'value' in a find query in PyMongo?
I'd use the
aggregate
method with$project
operator.From mongodb web docs.
e.g.
see http://docs.mongodb.org/manual/reference/aggregation/#_S_project