19 lines
282 B
JavaScript
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)
|
|
}
|