mongoose 6.3.3 → 6.3.6
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/.eslintrc.json +1 -1
- package/dist/browser.umd.js +1 -1
- package/lgtm.yml +12 -0
- package/lib/cast/objectid.js +3 -2
- package/lib/connection.js +3 -2
- package/lib/document.js +15 -8
- package/lib/error/index.js +2 -2
- package/lib/helpers/clone.js +9 -2
- package/lib/helpers/common.js +3 -4
- package/lib/helpers/discriminator/areDiscriminatorValuesEqual.js +2 -2
- package/lib/helpers/isBsonType.js +5 -3
- package/lib/helpers/path/setDottedPath.js +14 -1
- package/lib/helpers/topology/isAtlas.js +15 -2
- package/lib/helpers/update/applyTimestampsToChildren.js +4 -0
- package/lib/index.js +4 -3
- package/lib/model.js +38 -54
- package/lib/query.js +4 -1
- package/lib/queryhelpers.js +3 -2
- package/lib/schema/decimal128.js +4 -4
- package/lib/schema/map.js +8 -0
- package/lib/schema/objectid.js +4 -3
- package/lib/schema/string.js +2 -2
- package/lib/schema.js +41 -2
- package/lib/types/DocumentArray/methods/index.js +3 -3
- package/lib/types/array/methods/index.js +3 -3
- package/lib/types/map.js +4 -4
- package/lib/utils.js +3 -4
- package/package.json +18 -16
- package/types/aggregate.d.ts +3 -4
- package/types/callback.d.ts +8 -0
- package/types/collection.d.ts +46 -0
- package/types/connection.d.ts +92 -72
- package/types/document.d.ts +1 -1
- package/types/error.d.ts +5 -1
- package/types/helpers.d.ts +33 -0
- package/types/index.d.ts +32 -1859
- package/types/indizes.d.ts +98 -0
- package/types/middlewares.d.ts +14 -0
- package/types/models.d.ts +419 -0
- package/types/populate.d.ts +40 -0
- package/types/query.d.ts +637 -0
- package/types/schematypes.d.ts +418 -0
- package/types/session.d.ts +36 -0
- package/types/types.d.ts +102 -0
- package/types/utility.d.ts +13 -0
- package/types/validation.d.ts +32 -0
- package/.lgtm.yml +0 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare module 'mongoose' {
|
|
2
|
+
import mongodb = require('mongodb');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mongoose uses this function to get the current time when setting
|
|
6
|
+
* [timestamps](/docs/guide.html#timestamps). You may stub out this function
|
|
7
|
+
* using a tool like [Sinon](https://www.npmjs.com/package/sinon) for testing.
|
|
8
|
+
*/
|
|
9
|
+
function now(): NativeDate;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tells `sanitizeFilter()` to skip the given object when filtering out potential query selector injection attacks.
|
|
13
|
+
* Use this method when you have a known query selector that you want to use.
|
|
14
|
+
*/
|
|
15
|
+
function trusted<T>(obj: T): T;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the given value is a Mongoose ObjectId (using `instanceof`) or if the
|
|
19
|
+
* given value is a 24 character hex string, which is the most commonly used string representation
|
|
20
|
+
* of an ObjectId.
|
|
21
|
+
*/
|
|
22
|
+
function isObjectIdOrHexString(v: mongodb.ObjectId): true;
|
|
23
|
+
function isObjectIdOrHexString(v: string): boolean;
|
|
24
|
+
function isObjectIdOrHexString(v: any): false;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns true if Mongoose can cast the given value to an ObjectId, or
|
|
28
|
+
* false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
function isValidObjectId(v: mongodb.ObjectId): true;
|
|
31
|
+
function isValidObjectId(v: Types.ObjectId): true;
|
|
32
|
+
function isValidObjectId(v: any): boolean;
|
|
33
|
+
}
|