[GODRIVER-604] Cursor should return the objectID ("_id) Created: 19/Oct/18 Updated: 27/Oct/23 Resolved: 09/Nov/18 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Core API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mihai B | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Cursor has a ID() int64 method which seems to serve no purpose, at least not for the end user of the API. I propose to either replace this or add a new method ObjectID() which should return the objectID (_id) of the current/latest element from cursor. Currently there doesn't seem to me a method to get the objectID unless you create new types with an additional "_id" field for each result. |
| Comments |
| Comment by Kristofer Brandow (Inactive) [ 05/Nov/18 ] |
|
Closed due to inactivity. |
| Comment by Kristofer Brandow (Inactive) [ 22/Oct/18 ] |
|
Hi themihai, Currently the ID field returns the server cursor ID for the cursor. Additionally, since the _id of a document may not be an ObjectID, we cannot have a method that returns the ObjectID. If you want the _id you can retrieve the raw bytes, turn it into a bson.Reader and then Lookup the _id element. --Kris |