mirror of
https://github.com/vale981/grapher
synced 2025-03-05 09:31:42 -05:00
20 lines
601 B
JavaScript
20 lines
601 B
JavaScript
import Query from './query/query.js';
|
|
import NamedQuery from './namedQuery/namedQuery.js';
|
|
import NamedQueryStore from './namedQuery/store.js';
|
|
|
|
_.extend(Mongo.Collection.prototype, {
|
|
createQuery(...args) {
|
|
if (typeof args[0] === 'string') {
|
|
//NamedQuery
|
|
const [name, body, options] = args;
|
|
const query = new NamedQuery(name, this, body, options);
|
|
NamedQueryStore.add(name, query);
|
|
|
|
return query;
|
|
} else {
|
|
const [body, options] = args;
|
|
|
|
return new Query(this, body, options);
|
|
}
|
|
},
|
|
});
|