Create a domain (required to call the update
function) from an object
describing the domain.
This is a bit silly, it really just transforms from one representation to the other... we can design this API better, let's try soon?
If your goal is to keep types in separate files, use it like this:
const domain = createDomain(
'things',
[
{ type: 'things', definition: require('./things').default },
{ type: 'otherThings', definition: require('./other-things').default }
]
)
... and then use the domain
when calling update()
.
Type: {type: string, definition: any}
(string)
(any)
TODO: on insert... we certainly won't have this document in our cache yet!
oplog.on('insert', doc => {
const type = doc.ns.match(^${ dbName }\.(.+)$
)[1]
const key = doc.o2._id
})
(any)
(any)