mongodb/mongo-python-driver — pull request #201 by hensom (2013-09-18 15:45:27+00:00)
Title: Cursors now support setting comments

I added support for setting a comment on a cursor. The comment is currently propagated during queries, counts, and distinct commands:

db.foo.find({}).comment('bar')
db.foo.find({}).comment('bar').count()
db.foo.find({}).comment('bar').distinct('zot')

For the count and distinct commands I'm currently just adding a '$comment' property to the command itself. This appears to work in practice and the comment is stored in the profile collection. I tested this with mongo 2.4.6, but I was unsure if the general approach was correct there.