Skip to content
Myr

Added mongoose _id documentation (#114)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sylvanus Kateile · committed by Andrey Sitnik · parent bcffb4c · Browse files · 1 file+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−0 removed

  • other:+12 added−0 removed

1 file+12 added−0 removed

modified:README.md+12 added
280 unmodified lines
281 user.id = await format(random, url, 10)282}283```284285## Mongoose Unique Id286```js287const nanoId = require('nanoid');288const mongoose = require('mongoose');289const Schema = mongoose.Schema;290291const mySchema = new Schema({292 _id: {293 type: String,294 default: () => nanoId()295 }296}297```298## Tools299300* [ID size calculator] to choice smaller ID size depends on your case.301* [`nanoid-dictionary`] with popular alphabets to use with `nanoid/generate`.
29 unmodified lines