Re-wrote parenting, should be significantly faster, more maintainable

This commit is contained in:
Stefan Zermatten
2019-03-08 13:57:24 +02:00
parent 15c11e16ab
commit febb65a513
10 changed files with 339 additions and 264 deletions

View File

@@ -0,0 +1,12 @@
import getCollectionByName from '/imports/api/parenting/getCollectionByName.js';
const docNotFoundError = function({id, collection}){
throw new Meteor.Error('document-not-found',
`No document could be found with id: ${id} in ${collection}`
);
};
export default function fetchDocByRef({id, collection}, options){
return getCollectionByName(collection).findOne(id, options) ||
docNotFoundError({id, collection});
};