Skip to content

Trigger + aggregation + $merge not working #98

Description

@coodoo

Following code runs fine with nodejs and aggregated results will be inserted into zz collection, but the same code running via trigger (atlas + stitch) always failed to insert results into zz, wondering is this expected or a bug?

db.getCollection('bakesales')
  .aggregate( [
    { $match: { date: { $gte: new Date('1970-01-01') } } },
    { $group: { _id: { $dateToString: { format: "%Y-%m", date: "$date" } }, sales_quantity: { $sum: "$quantity"}, sales_amount: { $sum: "$amount" } } },
    { $merge: { into: {db: 'test', coll:"zz"}, whenMatched: "replace" } }
  ] )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions