Skip to content

How to use $push of $group mongo with data > 16MB? #5

@thearabbit

Description

@thearabbit

I would like to use $push on $group with Million of data.
Ex:

data = [
  {item: 'A', date, qty, price, amount..},
  {item: 'A', date, qty, price, amount..},
  {item: 'B', date, qty, price, amount..},
  ...........
]
----------------
Inventories.aggregate([
    {
        $group: {
            _id: "$item", 
            data: {
                $push: {
                    date: "$date",
                    qty:"$qty",
                    price:"$price",
                    amount:"$amount",
                }
            }
        }
    }
])

I got the error Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in.
And then I tried

.......([....], { allowDiskUse: true })

I got the error BSONObj size: 19046166 (0x1229F16) is invalid. Size must be between 0 and 16793600(16MB) First element: id: 293825087070.

Could help me???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions