[CDRIVER-3432] No longer require `gethostname` to generate ObjectIDs Created: 18/Nov/19 Updated: 23/Jun/23 Resolved: 23/Jun/23 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libbson |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matt Broadstone | Assignee: | Josh Siegel (Inactive) |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Improve Developer Experience |
| Quarter: | FY24Q2 |
| Description |
|
I noticed while making static builds of libbson for libmongocrypt that we have a dependency in libbson for ws_32.lib on windows, so it can provide gethostname. As I suspected, this was being used for ObjectId generation. The recently written ObjectId specification no longer requires a hostname, so this can be dropped from the libbson implementation. I think it would make the library even more portable. |
| Comments |
| Comment by Josh Siegel (Inactive) [ 23/Jun/23 ] |
|
Although ObjectID's specification no longer requires a hostname, it still requires a random value that is unique to the machine and process (https://github.com/mongodb/specifications/blob/master/source/objectid.rst#random-value). The current implementation of the C Driver uses the hostname for this "machine uniqueness" property, so it is still required. |