I got exceeds maximum document size problem exception by the query as follows,
exceeds maximum document size problem
pipe = [ {\"$match\": { \"birthday\":{\"$gte\":datetime.datet
Use following snippet
db.patients.runCommand('aggregate', {pipeline: [ {"$project": {"birthday":1, "id":1}}, {"$match": { "birthday":{"$gte":datetime.datetime(1987, 1, 1, 0, 0)} }} ], allowDiskUse: true})
here allowDiskUse will help to find out exceed 16 MB data