Files
DiceCloud/app/imports/api/parenting/getCollectionByName.js
2019-07-30 13:07:31 +02:00

12 lines
355 B
JavaScript

const collectionDoesntExistError = function(collectionName){
throw new Meteor.Error('bad-collection-reference',
`Parent references collection ${collectionName}, which does not exist`
);
};
const getCollectionByName = function(name){
return Mongo.Collection.get(name) || collectionDoesntExistError(name);
};
export default getCollectionByName;