elseware-nodejs 1.8.3 → 1.8.5
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/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1818,7 +1818,9 @@ declare const GlobalErrorHandler: (isProd?: boolean) => (err: unknown, _req: Req
|
|
|
1818
1818
|
declare const validate: (schema: Schema) => (req: Request, _res: Response, next: NextFunction) => void;
|
|
1819
1819
|
|
|
1820
1820
|
type Filter<T> = Partial<Record<keyof T, unknown>>;
|
|
1821
|
-
type
|
|
1821
|
+
type Field<T> = Extract<keyof T, string>;
|
|
1822
|
+
type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
|
|
1823
|
+
type Select<T> = (Field<T> | PrefixedField<T>)[] | Partial<Record<Field<T>, 0 | 1>>;
|
|
1822
1824
|
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1823
1825
|
|
|
1824
1826
|
interface IQueryOptions<T> {
|
|
@@ -1826,6 +1828,7 @@ interface IQueryOptions<T> {
|
|
|
1826
1828
|
sort?: Sort<T>;
|
|
1827
1829
|
limit?: number;
|
|
1828
1830
|
skip?: number;
|
|
1831
|
+
populate?: string | string[];
|
|
1829
1832
|
}
|
|
1830
1833
|
interface IUpdateQueryOptions {
|
|
1831
1834
|
new?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1818,7 +1818,9 @@ declare const GlobalErrorHandler: (isProd?: boolean) => (err: unknown, _req: Req
|
|
|
1818
1818
|
declare const validate: (schema: Schema) => (req: Request, _res: Response, next: NextFunction) => void;
|
|
1819
1819
|
|
|
1820
1820
|
type Filter<T> = Partial<Record<keyof T, unknown>>;
|
|
1821
|
-
type
|
|
1821
|
+
type Field<T> = Extract<keyof T, string>;
|
|
1822
|
+
type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
|
|
1823
|
+
type Select<T> = (Field<T> | PrefixedField<T>)[] | Partial<Record<Field<T>, 0 | 1>>;
|
|
1822
1824
|
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1823
1825
|
|
|
1824
1826
|
interface IQueryOptions<T> {
|
|
@@ -1826,6 +1828,7 @@ interface IQueryOptions<T> {
|
|
|
1826
1828
|
sort?: Sort<T>;
|
|
1827
1829
|
limit?: number;
|
|
1828
1830
|
skip?: number;
|
|
1831
|
+
populate?: string | string[];
|
|
1829
1832
|
}
|
|
1830
1833
|
interface IUpdateQueryOptions {
|
|
1831
1834
|
new?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -5179,6 +5179,15 @@ var BaseMongoRepository = class {
|
|
|
5179
5179
|
if (options.sort) query = query.sort(options.sort);
|
|
5180
5180
|
if (options.limit) query = query.limit(options.limit);
|
|
5181
5181
|
if (options.skip) query = query.skip(options.skip);
|
|
5182
|
+
if (options.populate) {
|
|
5183
|
+
if (Array.isArray(options.populate)) {
|
|
5184
|
+
options.populate.forEach((p) => {
|
|
5185
|
+
query = query.populate(p);
|
|
5186
|
+
});
|
|
5187
|
+
} else {
|
|
5188
|
+
query = query.populate(options.populate);
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5182
5191
|
return query;
|
|
5183
5192
|
}
|
|
5184
5193
|
toPlain(doc) {
|