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

17 lines
386 B
JavaScript

'use strict'
module.exports = {
getActor
}
const actorProj = { _id: 0, _meta: 0 }
const metaActorProj = { _id: 0 }
function getActor (id, db, includeMeta) {
return db.collection('objects')
.find({ id: id })
.limit(1)
// strict comparison as we don't want to return private keys on accident
.project(includeMeta === true ? metaActorProj : actorProj)
.next()
}