Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukaswilkeer/reproduce-hex-string-issue
https://github.com/lukaswilkeer/reproduce-hex-string-issue
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lukaswilkeer/reproduce-hex-string-issue
- Owner: lukaswilkeer
- Created: 2019-12-21T20:05:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-29T14:21:43.000Z (about 5 years ago)
- Last Synced: 2024-11-14T12:55:27.634Z (3 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reproduce-hex-string-issue
### Reproduceble example of toHexString problem.
This issue was referenced at [automattic/mongoose #8423](https://github.com/Automattic/mongoose/issues/8423)
The problem could be solved using a middleware on get method of a model to convert the string of a BSON type to a hex string on init of project.
using the method `toString()`, removing the timestamp and the random number, or using `toHexString()` of a BSON buffer.
[Mentioned here](https://github.com/Automattic/mongoose/issues/7968).[quote]
```
// Works if you put this line here
mongoose.ObjectId.get(v => v.toString());
```**To test:**
`npm install`
`npm test`
Before you'll need to import the mongo data, using mongoimport:
```mongoimport --db=blink --collection=clocks```
### Status
Current fixed using .id intead ._id method.