[GODRIVER-903] ListCollections and IndexView.List should include a type to unmarshal into Created: 25/Mar/19 Updated: 28/Oct/23 Resolved: 21/Aug/20 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | CRUD |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Brian Samek | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | rp-track | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Currently, ListCollections returns a cursor. In order to unmarshal this cursor, you have to create a struct that matches the output of ListCollections. It would be helpful if the Go driver provided this type. EDIT: A similar helper type was also added for IndexView.List in scope of this ticket. |
| Comments |
| Comment by Githook User [ 21/Aug/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: Co-authored-by: kriti ravindran <kriti.ravindran@mongodb.com> |
| Comment by Divjot Arora (Inactive) [ 13/Aug/20 ] |
| Comment by Christopher Sterling [ 05/Mar/20 ] |
|
We could definitely add a new function and a new type under the covers to unpack the list. My goal would be to convert that to some sort of interactive index object. I figured since IndexModel{} already had a decent amount of functionality around it, in theory we could cast the list and unpack it into a pseudo-style IndexModel{}. |
| Comment by Divjot Arora (Inactive) [ 04/Mar/20 ] |
|
topher@develops.guru Per semver, we can't make backwards-breaking changes like that, but I am open to adding new API to do this. Also, IndexModel doesn't exactly capture the return type of the listIndexes command so we'd have to introduce a new type to do this. |
| Comment by Christopher Sterling [ 04/Mar/20 ] |
|
It would be nice to modify ListCollections() AND Indexes().List() so that rather than getting a cursor, it just returned a slice of Collection{} and a slice of IndexModel{} respectively. Under the covers, a cursor could be used internally in that function. |
| Comment by Ian Whalen (Inactive) [ 25/Mar/19 ] |
|
moving to the backlog, although in the meantime you can workaround by writing your own struct. |