Re-wrote parenting, should be significantly faster, more maintainable
This commit is contained in:
11
app/imports/api/parenting/getCollectionByName.js
Normal file
11
app/imports/api/parenting/getCollectionByName.js
Normal file
@@ -0,0 +1,11 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user