@ewb/mongoose-query 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Query.d.ts CHANGED
@@ -41,6 +41,7 @@ export declare class Query<R extends object, T extends object = object, Q extend
41
41
  defaultSelect(select: MongooseSortSelectValue<T>[]): void;
42
42
  addPopulate(populate: mongoose.PopulateOptions | mongoose.PopulateOptions[]): void;
43
43
  addRoot(query: QueryType<T>): QueryType<T>;
44
+ removeRoot(key: string): QueryType<T>;
44
45
  addRootNext(query: QueryType<T>): QueryType<T>;
45
46
  removeQuery(key: keyof QueryType<T>): void;
46
47
  deleteKeysFromQuery(key: keyof QueryType<T>): void;
package/lib/Query.js CHANGED
@@ -102,6 +102,12 @@ export class Query {
102
102
  };
103
103
  return this._root;
104
104
  }
105
+ removeRoot(key) {
106
+ if (this._root && key in this._root) {
107
+ delete this._root[key];
108
+ }
109
+ return this._root;
110
+ }
105
111
  addRootNext(query) {
106
112
  this._rootNext = {
107
113
  ...(this._rootNext || {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ewb/mongoose-query",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "description": "Parse queries and params to mongoose search. Strips dangerous keys and set corrects options with help of query values.",
6
6
  "main": "./lib/index.js",