How could I write aggregation without exceeds maximum document size?

前端 未结 3 1898
感动是毒
感动是毒 2020-12-10 05:51

I got exceeds maximum document size problem exception by the query as follows,

pipe = [
    {\"$match\": { \"birthday\":{\"$gte\":datetime.datet         


        
3条回答
  •  半阙折子戏
    2020-12-10 06:33

    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

提交回复
热议问题