2018-03-29 19:04:43 +03:00
|
|
|
import { Mongo } from 'meteor/mongo';
|
2018-03-30 06:42:02 +03:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2018-03-29 19:04:43 +03:00
|
|
|
|
2018-03-30 05:47:11 +03:00
|
|
|
const db = new Proxy(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
get: function(obj, prop) {
|
2018-07-23 13:06:48 +03:00
|
|
|
if (typeof prop === 'symbol') {
|
|
|
|
return obj[prop];
|
|
|
|
}
|
|
|
|
|
2018-03-30 05:47:11 +03:00
|
|
|
const collection = Mongo.Collection.get(prop);
|
2018-03-29 19:04:43 +03:00
|
|
|
|
2018-03-30 05:47:11 +03:00
|
|
|
if (!collection) {
|
2018-07-23 13:06:48 +03:00
|
|
|
return obj[prop];
|
2018-03-30 05:47:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return collection;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
2018-03-29 19:04:43 +03:00
|
|
|
|
|
|
|
export default db;
|