uuid-mongodb
Advanced tools
Comparing version 2.3.0 to 2.3.2
{ | ||
"name": "uuid-mongodb", | ||
"version": "2.3.0", | ||
"version": "2.3.2", | ||
"description": "Generates and parses MongoDB BSON UUIDs. Plays nicely with others including the MongoDB native driver and Mongoose.", | ||
@@ -27,15 +27,15 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"uuid": "^8.0.0" | ||
"uuid": "^8.3.0" | ||
}, | ||
"peerDependencies": { | ||
"mongodb": "^3.5.7" | ||
"mongodb": "^3.6.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.0.0", | ||
"eslint": "^7.9.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"mocha": "^7.1.2", | ||
"mongodb": "^3.5.7", | ||
"prettier": "^2.0.5" | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"mocha": "^8.1.3", | ||
"mongodb": "^3.6.2", | ||
"prettier": "^2.1.1" | ||
} | ||
} |
@@ -41,15 +41,2 @@ # uuid-mongodb | ||
## Modes | ||
uuid-mongodb offers two modes, **canonical** (default) and **relaxed**. | ||
- **canonical** - A string format that emphasizes type preservation at the expense of readability and interoperability. | ||
- **relaxed** - A string format that emphasizes readability and interoperability at the expense of type preservation. | ||
Modes are set globally. here is how set the mode | ||
```javascript | ||
const mUUID = MUUID.mode('relaxed') | ||
``` | ||
## Formatting | ||
@@ -75,2 +62,24 @@ | ||
## Modes | ||
uuid-mongodb offers two modes: | ||
- **canonical** (default) - A string format that emphasizes type preservation at the expense of readability and interoperability. | ||
- **relaxed** - A string format that emphasizes readability and interoperability at the expense of type preservation. | ||
The mode is set **globally** as such: | ||
```javascript | ||
const mUUID = MUUID.mode('relaxed'); // use relaxed mode | ||
``` | ||
Mode _**only**_ impacts how `JSON.stringify(...)` represents a UUID: | ||
e.g. `JSON.stringy(mUUID.v1())` outputs the following: | ||
```javascript | ||
"DEol4JenEeqVKusA+dzMMA==" // when in 'canonical' mode | ||
"1ac34980-97a7-11ea-8bab-b5327b548666" // when in 'relaxed' mode | ||
``` | ||
## Examples | ||
@@ -161,2 +170,14 @@ | ||
- [example/ex4-mongoose.js](example/ex4-mongoose.js) | ||
```javascript | ||
const uuid = MUUID.v4(); | ||
// save record and wait for it to commit | ||
await new Data({ uuid }).save(); | ||
// retrieve the record | ||
const result = await Data.findOne({ uuid }); | ||
``` | ||
## Notes | ||
@@ -163,0 +184,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13321
204
Updateduuid@^8.3.0