rubberguppe/store/object.js
2019-09-22 00:20:37 -05:00

19 lines
282 B
JavaScript

'use strict'
module.exports = {
get,
save
}
function get (id, db) {
return db.collection('objects')
.find({ id: id })
.limit(1)
.project({ _id: 0, _meta: 0 })
.next()
}
function save (object, db) {
return db.collection('objects')
.insertOne(object)
}