[DOCS-14872] Aggregation Pipeline in Custom Resolver Example is buggy Created: 15/Oct/21  Updated: 04/Jan/23  Resolved: 19/Oct/21

Status: Closed
Project: Documentation
Component/s: Realm
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Philip Eschenbacher Assignee: Nicholas Larew
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screenshot 2021-10-15 at 15.48.45.png    
Participants:
Days since reply: 2 years, 16 weeks, 1 day ago
Story Points: 3

 Description   

In the Realm documentation in the section "Define a Customer Resolver" is an error in the aggregation pipeline that is embedded in the function example which should resolve the result set.

https://docs.mongodb.com/realm/graphql/custom-resolvers/#custom-query-resolver

The actual pipeline is not working and resolves to an annoying error which is hard to find out when you try to work with the example. 

The correct pipeline in this function should look like this to work:

[{$match: {
  month: month,
  year: year
}}, {$group: {
  _id: {
    month: "$month",
    year: "$year"
  },
  averageSale: {
    $avg: "$saleTotal"
  }
}}, {$project: {
  month: "$_id.month",
  year: "$_id.year",
  averageSale: 1
}}]

 

 



 Comments   
Comment by Nicholas Larew [ 19/Oct/21 ]

https://github.com/mongodb/docs-realm/pull/1425

Generated at Thu Feb 08 08:11:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.