I got exceeds maximum document size problem
exception by the query as follows,
pipe = [
{"$match": { "birthday":{"$gte":datetime.datetime(1987, 1, 1, 0, 0)} }}
]
res =db.patients.aggregate(pipe,allowDiskUse=True)
I fixed it by adding the $project
operator,
However what if the document still over 16MB
even I use $project
?
What can I do ? any idea ? Thank you
pipe = [
{"$project": {"birthday":1, "id":1}
},
{"$match": { "birthday":{"$gte":datetime.datetime(1987, 1, 1, 0, 0)} }
}
]
res =db.patients.aggregate(pipe,allowDiskUse=True)
Exception
OperationFailure: command SON([('aggregate', 'patients'), ('pipeline', [{'$match': {'birthday': {'$gte': datetime.datetime(1987, 1, 1, 0, 0)}}}]), ('allowDiskUse', True)]) on namespace tw_insurance_security_development.$cmd failed: exception: aggregation result exceeds maximum document size (16MB)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…