2017-11-28 17:38:51 +02:00
|
|
|
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 {
|
2017-11-30 17:00:33 +02:00
|
|
|
const [body, options] = args;
|
2017-11-28 17:38:51 +02:00
|
|
|
|
2017-11-30 17:00:33 +02:00
|
|
|
return new Query(this, body, options);
|
2017-11-28 17:38:51 +02:00
|
|
|
}
|
2018-03-29 19:04:43 +03:00
|
|
|
},
|
|
|
|
});
|