-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
The documentation for createId indicates that it will be passed the collectionName and the item for which an id is being generated. It appears that it is actually passed the collection, as opposed to the collectionName. See
Line 42 in adf8c8e
| createId: function (collection, doc) { |
example:
import low from 'lowdb'
import FileSync from 'lowdb/adapters/FileSync'
import lodashId from 'lodash-id'
import shortId from 'shortid'
const adapter = new FileSync('../../db.json')
const db = low(adapter)
db._.mixin(lodashId)
db._.createId = (collectionName) => {
console.log(collectionName) // I expect collectionName to be 'sprockets'. Instead it is `[]`
return `${collectionName}-${shortId.generate()}`
}
db.defaults({
sprockets: []
}).write()
db.get('sprockets').upsert({ name: 'my sprocket' }).write()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels