【发布时间】:2020-01-21 14:19:31
【问题描述】:
我正在从应用程序发送获取请求并收到以下错误:
{"$push used too much memory and cannot spill to disk. Memory limit: 104857600 bytes"}
我正在使用具有 4GB 内存和 20GB 存储空间的 atlas 托管 mongo-db。我想,我需要更新一些配置设置,但我缺少它。谁能帮我解决这个错误。
添加查询
db.collection1.aggregate([ { '$match': {} }, { '$lookup': { from: 'collection2', localField: 'pfId', foreignField: 'pfId', as: 'pt' } }, { '$unwind': '$pt' }, { '$match': {} }, { '$lookup': { from: 'collection3', localField: 'pt.ptId', foreignField: 'ptId', as: 'pd' } }, { '$unwind': '$pd' }, { '$match': {} }, { '$lookup': { from: 'collection4', localField: 'pd.pdId', foreignField: 'pdId', as: 'dl' } }, { '$unwind': '$dl' }, { '$match': { 'dl.currentdl': { '$ne': 'OBSOLETE' }, '$or': [ { 'pd.pdName': { '$regex': /^.*world.*/i } }, { 'dl.r.dF': { '$regex': /^.*world.*/i } }, { 'dl.dlType': { '$regex': /^.*world.*/i } }, { 'dl.dlId': 'WORLD' }, { 'dl.logUserId': 'WORLD' } ] } }, { '$project': {//some_fields} }, { '$group': { _id: null, count: { '$sum': 1 }, results: { '$push': '$$ROOT' } } }, { '$project': { count: 1, results: { '$slice': [ '$results',
0, 10 ] } } }], { allowDiskUse: true })
我必须对数据进行分页,同时检索获取的数据计数。
【问题讨论】:
-
是的,内存限制在那里,我们可以使用allowDiskUse,但现在从mongo 4.0.14开始,它给出了上述错误,与allowDiskUse无关
-
您可能希望发布有关查询、集合和索引的其他详细信息
标签: mongodb configuration