2016-09-14 16:04:08 +03:00
|
|
|
import Query from './query.js';
|
|
|
|
|
|
|
|
_.extend(Mongo.Collection.prototype, {
|
2017-06-28 10:34:42 +02:00
|
|
|
createQuery(...args) {
|
|
|
|
if (args[0] == 'string') { //NamedQuery
|
|
|
|
const name = args[0];
|
|
|
|
const body = args[1];
|
|
|
|
const params = args[2];
|
|
|
|
|
|
|
|
const query = new NamedQuery(name, this, body, params);
|
|
|
|
NamedQueryStore.add(name, query);
|
2017-06-28 13:42:50 +02:00
|
|
|
|
2017-06-28 10:34:42 +02:00
|
|
|
return query;
|
|
|
|
} else { //Query
|
|
|
|
const body = args[0];
|
|
|
|
const params = args[1];
|
|
|
|
|
2016-09-14 16:04:08 +03:00
|
|
|
return new Query(this, body, params);
|
2017-06-28 10:34:42 +02:00
|
|
|
}
|
2016-09-14 16:04:08 +03:00
|
|
|
}
|
|
|
|
});
|