@ewb/mongoose-query 1.0.1 → 1.0.2
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/QueryHandler.d.ts +2 -2
- package/lib/QueryHandler.js +4 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/utils/constants.d.ts +0 -1
- package/lib/utils/constants.js +0 -1
- package/package.json +1 -1
package/lib/QueryHandler.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ export declare class QueryHandler<T extends object> {
|
|
|
25
25
|
deleteOne(filter: mongoose.FilterQuery<T>): Promise<mongoose.mongo.DeleteResult>;
|
|
26
26
|
populate(query: Query<T>, doc: T | T[any], type?: keyof ModelSearchPopulate<T, any>): Promise<void>;
|
|
27
27
|
getPopulates(type: keyof ModelSearchPopulate<T, any>): ModelSearchPopulate<T, keyof T>[];
|
|
28
|
-
updateMany(
|
|
29
|
-
deleteMany(
|
|
28
|
+
updateMany(query: mongoose.FilterQuery<T>, $in: mongoose.Types.ObjectId[], body: Partial<T>): Promise<mongoose.UpdateWriteOpResult>;
|
|
29
|
+
deleteMany(query: mongoose.FilterQuery<T>, $in: mongoose.Types.ObjectId[]): Promise<mongoose.mongo.DeleteResult>;
|
|
30
30
|
subCreate<K extends keyof T>(sub: K, query: Query<T>, body: any): Promise<(T[K] extends [] ? T[K][0] : null) | null>;
|
|
31
31
|
subSearch<K extends keyof T>(sub: K, query: Query<T>, rootQuery: mongoose.FilterQuery<T>): Promise<{
|
|
32
32
|
count: number;
|
package/lib/QueryHandler.js
CHANGED
|
@@ -76,11 +76,11 @@ export class QueryHandler {
|
|
|
76
76
|
}
|
|
77
77
|
return populate.filter((x) => x[type] || x.onAll);
|
|
78
78
|
}
|
|
79
|
-
async updateMany(
|
|
80
|
-
return this._model.updateMany({ _id: { $in
|
|
79
|
+
async updateMany(query, $in, body) {
|
|
80
|
+
return this._model.updateMany({ ...query, _id: { $in } }, { $set: body });
|
|
81
81
|
}
|
|
82
|
-
async deleteMany(
|
|
83
|
-
return this._model.deleteMany({ _id: { $in
|
|
82
|
+
async deleteMany(query, $in) {
|
|
83
|
+
return this._model.deleteMany({ ...query, _id: { $in } });
|
|
84
84
|
}
|
|
85
85
|
async subCreate(sub, query, body) {
|
|
86
86
|
if (!('_id' in body)) {
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './Query';
|
|
|
3
3
|
export * from './QueryHandler';
|
|
4
4
|
export * from './QueryHistory';
|
|
5
5
|
export * from './QueryModel';
|
|
6
|
+
export * from './utils/Query.utils';
|
|
7
|
+
export * from './utils/types';
|
|
6
8
|
export { toValidNumber } from './utils/Query.utils';
|
|
7
9
|
export { ISearchPaginate } from './utils/utils';
|
|
8
10
|
export { IQueryAddToModelQuery } from './utils/types';
|
package/lib/index.js
CHANGED
package/lib/utils/constants.d.ts
CHANGED
package/lib/utils/constants.js
CHANGED
package/package.json
CHANGED