You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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()
The text was updated successfully, but these errors were encountered:
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. Seelodash-id/src/index.js
Line 42 in adf8c8e
example:
The text was updated successfully, but these errors were encountered: