Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger + aggregation + $merge not working #98

Open
coodoo opened this issue Feb 1, 2020 · 0 comments
Open

Trigger + aggregation + $merge not working #98

coodoo opened this issue Feb 1, 2020 · 0 comments

Comments

@coodoo
Copy link

coodoo commented Feb 1, 2020

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" } }
  ] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant