[GODRIVER-740] Add example for the aggregation framework usage Created: 01/Jan/19  Updated: 08/Oct/19  Resolved: 08/Oct/19

Status: Closed
Project: Go Driver
Component/s: Documentation
Affects Version/s: 0.0.15
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Nahshon Unna-Tsameret Assignee: Kristofer Brandow (Inactive)
Resolution: Duplicate Votes: 0
Labels: aggregation, driver, go, golang
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All



 Description   

Using the aggregation framework in mongodb-go-driver is not trivial, e.g. building the pipeline: the first guess, a slice of bson.Ds or a bson.A are not working, but only Pipeline.

That why a usage example is needed, with a simple code, just to expose the relevant APIs and types and how a working aggregation code looks like.



 Comments   
Comment by Divjot Arora (Inactive) [ 08/Oct/19 ]

closing as duplicate of GODRIVER-225

Comment by Scott L'Hommedieu (Inactive) [ 05/Feb/19 ]

Hi nahsh, Thanks for the PR!  As kris.brandow mentioned the examples as you've submitted won't generate the output that would provide a visible doc example.
I do understand the need for these agg examples.  GODRIVER-225 specifies these examples.  You can follow that ticket to completion or participate if you'd like.

Comment by Ian Whalen (Inactive) [ 04/Feb/19 ]

Hey nahsh, thanks a lot  for the suggestion - we can't integrate this PR as posted because it won't actually generate docs pages likes all of the other examples do.  We really like the idea of expanding agg examples in the docs, however, and are going to look into doing this across all drivers.

Comment by Nahshon Unna-Tsameret [ 15/Jan/19 ]

Hi Kris. Thanks for your comment. The bug above is not the whole story, and I added []bson.D and []bson.M example. the main issue is the lack of any aggregation example.

Comment by Kristofer Brandow (Inactive) [ 04/Jan/19 ]

Hi nahsh,

The issue with []bson.D and bson.A was resolved in GODRIVER-679, and a slice of any type that can be converted into a BSON document should be a valid parameter to Collection.Aggregate. The fix will be available in the next beta release.

--Kris

Comment by Nahshon Unna-Tsameret [ 01/Jan/19 ]

Pull request with a working example: https://github.com/mongodb/mongo-go-driver/pull/129

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