[GODRIVER-1335] Pipe & iter types equivalent in new golang driver Created: 09/Oct/19 Updated: 28/Oct/19 Resolved: 28/Oct/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | chakrapani velugubantla | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Hello , I leverage mongoeye(https://github.com/mongoeye) which leverages mgo.v2(https://godoc.org/gopkg.in/mgo.v2) for getting key info & types across collection . I ran into edge-cases around ssl & authmechanism which new driver addresses . however, i am wondering if there is any roadmap to create mgo.Pipe & Mgo.Iter types in newest driver or their functionality or if there is a way to grab key info across collection in newest driver
thanks chakri |
| Comments |
| Comment by Divjot Arora (Inactive) [ 11/Oct/19 ] | |||||
|
Thanks for the clarification chakri123@gmail.com. The BatchSize and AllowDiskUse options can be leveraged through the options package. I don't know what kind of pipeline you'd need off the top of my head to get the keys in a collection. Looking at your code sample, however, it seems like you have multiple stages, each of which is a bson.M. You can do the same thing in the Go driver as the pipeline parameter will accept a slice of documents. To put it all together, here's a small code sample:
Let us know if you have any other questions about aggregations in the driver. – Divjot | |||||
| Comment by chakrapani velugubantla [ 11/Oct/19 ] | |||||
|
Hello , pipeline.go regarding grab keys. to elaborate on that.. is there a way to get all keys within a collection for example:
collection doc sample will be {"key1": "val1" , "key2" : "val2" , "key3" : [ \{"key3-1" : "val3-1" , "key-3-2" : "val-3-2" } ]}
looking for a way to get key1, key2 , key3.key3-1 , key3.key-3-2
thanks CHakri
| |||||
| Comment by Divjot Arora (Inactive) [ 10/Oct/19 ] | |||||
|
Also, we weren't sure what you meant by "grab key info across collection". Can you elaborate on this? | |||||
| Comment by Divjot Arora (Inactive) [ 10/Oct/19 ] | |||||
|
Looking at the mgo source code, it looks like the Pipe type is used for aggregations, which can be done through the Collection.Aggregate and Database.Aggregate functions in the driver. The Iter type maps to the driver's mongo.Cursor type, which is returned from functions like Find and Aggregate. Is there specific functionality from the mgo types that you need that isn't present in the driver? |