rubberguppe/store/object.js

20 lines
282 B
JavaScript
Raw Normal View History

'use strict'
module.exports = {
2019-09-22 05:20:37 +00:00
get,
save
}
function get (id, db) {
2019-09-22 05:20:37 +00:00
return db.collection('objects')
.find({ id: id })
.limit(1)
2019-09-22 05:20:37 +00:00
.project({ _id: 0, _meta: 0 })
.next()
}
2019-09-22 05:20:37 +00:00
function save (object, db) {
return db.collection('objects')
.insertOne(object)
}