@sprucelabs/spruce-cli 17.1.11 → 17.1.14
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/CHANGELOG.md +24 -0
- package/node_modules/@sprucelabs/data-stores/README.md +24 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/databaseNotConnected.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/databaseNotConnected.schema.js +23 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/duplicateKey.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/duplicateKey.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/duplicateRecord.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/duplicateRecord.schema.js +40 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/failedToLoadStore.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/failedToLoadStore.schema.js +18 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/failedToLoadStores.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/failedToLoadStores.schema.js +19 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/indexExists.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/indexExists.schema.js +20 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/indexNotFound.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/indexNotFound.schema.js +20 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidDatabaseName.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidDatabaseName.schema.js +18 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidDbConnectionString.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidDbConnectionString.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStore.schema copy.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStore.schema copy.js +25 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStore.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStore.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStoreName.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/invalidStoreName.schema.js +25 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/mongoIdMappingError.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/mongoIdMappingError.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/record-not-found-query.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/record-not-found-query.schema.js +15 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/recordNotFound.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/recordNotFound.schema.js +30 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/scrambleNotConfigured.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/scrambleNotConfigured.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unableToConnectToDb.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unableToConnectToDb.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownDatabaseError.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownDatabaseError.schema.js +18 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownError.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownError.schema.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownStoreError.schema.d.ts +3 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/dataStores/unknownStoreError.schema.js +27 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/errors.types.d.ts +383 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/errors.types.js +4 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/options.types.d.ts +58 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/errors/options.types.js +2 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/schemas/fields/fieldClassMap.d.ts +2 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/schemas/fields/fieldClassMap.js +4 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/schemas/fields/fields.types.d.ts +1 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/schemas/fields/fields.types.js +2 -0
- package/node_modules/@sprucelabs/data-stores/build/.spruce/settings.json +22 -0
- package/node_modules/@sprucelabs/data-stores/build/constants.d.ts +1 -0
- package/node_modules/@sprucelabs/data-stores/build/constants.js +4 -0
- package/node_modules/@sprucelabs/data-stores/build/cursors/CursorPager.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/cursors/CursorPager.js +129 -0
- package/node_modules/@sprucelabs/data-stores/build/cursors/CursorPagerFaker.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/cursors/CursorPagerFaker.js +25 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/MongoDatabase.d.ts +44 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/MongoDatabase.js +432 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/NeDbDatabase.d.ts +41 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/NeDbDatabase.js +447 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/mongo.types.d.ts +3163 -0
- package/node_modules/@sprucelabs/data-stores/build/databases/mongo.types.js +50 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/SpruceError.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/SpruceError.js +103 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/databaseNotConnected.builder.d.ts +15 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/databaseNotConnected.builder.js +17 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/duplicateKey.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/duplicateKey.builder.js +8 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/duplicateRecord.builder.d.ts +28 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/duplicateRecord.builder.js +30 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/failedToLoadStore.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/failedToLoadStore.builder.js +14 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/failedToLoadStores.builder.d.ts +16 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/failedToLoadStores.builder.js +21 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/indexExists.builder.d.ts +14 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/indexExists.builder.js +16 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/indexNotFound.builder.d.ts +14 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/indexNotFound.builder.js +16 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidDatabaseName.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidDatabaseName.builder.js +14 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidDbConnectionString.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidDbConnectionString.builder.js +9 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidStore.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidStore.builder.js +8 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidStoreName.builder.d.ts +16 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/invalidStoreName.builder.js +18 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/mongoIdMappingError.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/mongoIdMappingError.builder.js +12 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/recordNotFound.builder.d.ts +31 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/recordNotFound.builder.js +33 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/scrambleNotConfigured.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/scrambleNotConfigured.builder.js +12 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unableToConnectToDb.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unableToConnectToDb.builder.js +9 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownDatabaseError.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownDatabaseError.builder.js +14 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownError.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownError.builder.js +8 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownStoreError.builder.d.ts +19 -0
- package/node_modules/@sprucelabs/data-stores/build/errors/unknownStoreError.builder.js +21 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/.spruce/errors/errors.types.d.ts +383 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/.spruce/errors/errors.types.js +3 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/.spruce/errors/options.types.d.ts +58 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/.spruce/errors/options.types.js +1 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/constants.d.ts +1 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/constants.js +1 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/cursors/CursorPager.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/cursors/CursorPager.js +134 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/cursors/CursorPagerFaker.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/cursors/CursorPagerFaker.js +30 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/MongoDatabase.d.ts +44 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/MongoDatabase.js +476 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/NeDbDatabase.d.ts +41 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/NeDbDatabase.js +496 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/mongo.types.d.ts +3163 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/databases/mongo.types.js +36 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/SpruceError.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/SpruceError.js +97 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/databaseNotConnected.builder.d.ts +15 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/databaseNotConnected.builder.js +15 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/duplicateKey.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/duplicateKey.builder.js +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/duplicateRecord.builder.d.ts +28 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/duplicateRecord.builder.js +28 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/failedToLoadStore.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/failedToLoadStore.builder.js +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/failedToLoadStores.builder.d.ts +16 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/failedToLoadStores.builder.js +19 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/indexExists.builder.d.ts +14 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/indexExists.builder.js +14 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/indexNotFound.builder.d.ts +14 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/indexNotFound.builder.js +14 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidDatabaseName.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidDatabaseName.builder.js +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidDbConnectionString.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidDbConnectionString.builder.js +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidStore.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidStore.builder.js +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidStoreName.builder.d.ts +16 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/invalidStoreName.builder.js +16 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/mongoIdMappingError.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/mongoIdMappingError.builder.js +10 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/recordNotFound.builder.d.ts +31 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/recordNotFound.builder.js +31 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/scrambleNotConfigured.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/scrambleNotConfigured.builder.js +10 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unableToConnectToDb.builder.d.ts +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unableToConnectToDb.builder.js +7 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownDatabaseError.builder.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownDatabaseError.builder.js +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownError.builder.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownError.builder.js +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownStoreError.builder.d.ts +19 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/errors/unknownStoreError.builder.js +19 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/factories/DatabaseFactory.d.ts +10 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/factories/DatabaseFactory.js +32 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/factories/StoreFactory.d.ts +25 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/factories/StoreFactory.js +72 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/fixtures/DatabaseFixture.d.ts +22 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/fixtures/DatabaseFixture.js +99 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/fixtures/StoreFixture.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/fixtures/StoreFixture.js +25 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/index.d.ts +21 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/index.js +21 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/loaders/StoreLoader.d.ts +25 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/loaders/StoreLoader.js +120 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/mutexers/AbstractMutexer.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/mutexers/AbstractMutexer.js +56 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/stores/AbstractStore.d.ts +48 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/stores/AbstractStore.js +293 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/tests/AbstractDatabaseTest.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/tests/AbstractDatabaseTest.js +54 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/database.types.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/database.types.js +1 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/query.types.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/query.types.js +2 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/stores.types.d.ts +24 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/types/stores.types.js +10 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/error.utility.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/error.utility.js +23 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/generateId.d.ts +1 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/generateId.js +4 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/generateIdDeprecated.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/generateIdDeprecated.js +6 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/mongo.utility.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/esm/utilities/mongo.utility.js +104 -0
- package/node_modules/@sprucelabs/data-stores/build/factories/DatabaseFactory.d.ts +10 -0
- package/node_modules/@sprucelabs/data-stores/build/factories/DatabaseFactory.js +38 -0
- package/node_modules/@sprucelabs/data-stores/build/factories/StoreFactory.d.ts +25 -0
- package/node_modules/@sprucelabs/data-stores/build/factories/StoreFactory.js +65 -0
- package/node_modules/@sprucelabs/data-stores/build/fixtures/DatabaseFixture.d.ts +22 -0
- package/node_modules/@sprucelabs/data-stores/build/fixtures/DatabaseFixture.js +86 -0
- package/node_modules/@sprucelabs/data-stores/build/fixtures/StoreFixture.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/fixtures/StoreFixture.js +20 -0
- package/node_modules/@sprucelabs/data-stores/build/index.d.ts +21 -0
- package/node_modules/@sprucelabs/data-stores/build/index.js +53 -0
- package/node_modules/@sprucelabs/data-stores/build/loaders/StoreLoader.d.ts +25 -0
- package/node_modules/@sprucelabs/data-stores/build/loaders/StoreLoader.js +107 -0
- package/node_modules/@sprucelabs/data-stores/build/mutexers/AbstractMutexer.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/mutexers/AbstractMutexer.js +46 -0
- package/node_modules/@sprucelabs/data-stores/build/stores/AbstractStore.d.ts +48 -0
- package/node_modules/@sprucelabs/data-stores/build/stores/AbstractStore.js +285 -0
- package/node_modules/@sprucelabs/data-stores/build/tests/AbstractDatabaseTest.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/tests/AbstractDatabaseTest.js +37 -0
- package/node_modules/@sprucelabs/data-stores/build/types/database.types.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/types/database.types.js +2 -0
- package/node_modules/@sprucelabs/data-stores/build/types/query.types.d.ts +29 -0
- package/node_modules/@sprucelabs/data-stores/build/types/query.types.js +3 -0
- package/node_modules/@sprucelabs/data-stores/build/types/stores.types.d.ts +24 -0
- package/node_modules/@sprucelabs/data-stores/build/types/stores.types.js +13 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/error.utility.d.ts +5 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/error.utility.js +28 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/generateId.d.ts +1 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/generateId.js +7 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/generateIdDeprecated.d.ts +6 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/generateIdDeprecated.js +11 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/mongo.utility.d.ts +12 -0
- package/node_modules/@sprucelabs/data-stores/build/utilities/mongo.utility.js +109 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/gitignore.js +120 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/index.d.ts +186 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/index.js +181 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/license +9 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/package.json +82 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/readme.md +170 -0
- package/node_modules/@sprucelabs/data-stores/node_modules/globby/stream-utils.js +46 -0
- package/node_modules/@sprucelabs/data-stores/package.json +144 -0
- package/node_modules/@sprucelabs/data-stores/tsconfig.json +39 -0
- package/package.json +27 -27
|
@@ -0,0 +1,3163 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference lib="esnext.asynciterable" />
|
|
4
|
+
import { checkServerIdentity } from 'tls';
|
|
5
|
+
import { Binary, Decimal128, Double, Int32, Long, ObjectId, Timestamp } from 'bson';
|
|
6
|
+
import { BSONType, ChangeStream, ResumeToken } from 'mongodb';
|
|
7
|
+
import { AggregationCursor, Code } from 'mongodb';
|
|
8
|
+
import { ClientSession, MongoClient, MongoError, ReadPreference } from 'mongodb';
|
|
9
|
+
declare type Cursor<A = any> = A extends true ? any : any;
|
|
10
|
+
declare type CommandCursor = any;
|
|
11
|
+
declare type FlattenIfArray<T> = T extends ReadonlyArray<infer R> ? R : T;
|
|
12
|
+
export declare type WithoutProjection<T> = T & {
|
|
13
|
+
fields?: undefined;
|
|
14
|
+
projection?: undefined;
|
|
15
|
+
};
|
|
16
|
+
export { Binary, DBRef, Decimal128, Double, Int32, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp, } from 'bson';
|
|
17
|
+
declare type NumericTypes = number | Decimal128 | Double | Int32 | Long;
|
|
18
|
+
export declare type ClientSessionId = unknown;
|
|
19
|
+
/**
|
|
20
|
+
* The MongoDB ReadConcern, which allows for control of the consistency and isolation properties
|
|
21
|
+
* of the data read from replica sets and replica set shards.
|
|
22
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#ReadConcern
|
|
23
|
+
*/
|
|
24
|
+
declare type ReadConcernLevel = 'local' | 'available' | 'majority' | 'linearizable' | 'snapshot';
|
|
25
|
+
/**
|
|
26
|
+
* The MongoDB ReadConcern, which allows for control of the consistency and isolation properties
|
|
27
|
+
* of the data read from replica sets and replica set shards.
|
|
28
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#ReadConcern
|
|
29
|
+
*/
|
|
30
|
+
export interface ReadConcern {
|
|
31
|
+
level: ReadConcernLevel;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A MongoDB WriteConcern, which describes the level of acknowledgement
|
|
35
|
+
* requested from MongoDB for write operations.
|
|
36
|
+
*
|
|
37
|
+
* @param w requests acknowledgement that the write operation has propagated to a specified number of mongod hosts
|
|
38
|
+
* @param j requests acknowledgement from MongoDB that the write operation has been written to the journal
|
|
39
|
+
* @param timeout a time limit, in milliseconds, for the write concern
|
|
40
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#WriteConcern
|
|
41
|
+
*/
|
|
42
|
+
interface WriteConcern {
|
|
43
|
+
/**
|
|
44
|
+
* Requests acknowledgement that the write operation has
|
|
45
|
+
* propagated to a specified number of mongod hosts
|
|
46
|
+
* @default 1
|
|
47
|
+
*/
|
|
48
|
+
w?: number | 'majority' | string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Requests acknowledgement from MongoDB that the write operation has
|
|
51
|
+
* been written to the journal
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
j?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* A time limit, in milliseconds, for the write concern
|
|
57
|
+
*/
|
|
58
|
+
wtimeout?: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options to pass when creating a Client Session
|
|
62
|
+
*
|
|
63
|
+
* @param causalConsistency Whether causal consistency should be enabled on this session
|
|
64
|
+
* @param defaultTransactionOptions The default TransactionOptions to use for transactions started on this session.
|
|
65
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#SessionOptions
|
|
66
|
+
*/
|
|
67
|
+
export interface SessionOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Whether causal consistency should be enabled on this session
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
causalConsistency?: boolean | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The default TransactionOptions to use for transactions started on this session.
|
|
75
|
+
*/
|
|
76
|
+
defaultTransactionOptions?: TransactionOptions | undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Configuration options for a transaction.
|
|
80
|
+
*
|
|
81
|
+
* @param readConcern A default read concern for commands in this transaction
|
|
82
|
+
* @param writeConcern A default writeConcern for commands in this transaction
|
|
83
|
+
* @param readPreference A default read preference for commands in this transaction
|
|
84
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#TransactionOptions
|
|
85
|
+
*/
|
|
86
|
+
export interface TransactionOptions {
|
|
87
|
+
readConcern?: ReadConcern | undefined;
|
|
88
|
+
writeConcern?: WriteConcern | undefined;
|
|
89
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @param noListener Do not make the db an event listener to the original connection.
|
|
93
|
+
* @param returnNonCachedInstance Control if you want to return a cached instance or have a new one created
|
|
94
|
+
*/
|
|
95
|
+
export interface MongoClientCommonOption {
|
|
96
|
+
noListener?: boolean | undefined;
|
|
97
|
+
returnNonCachedInstance?: boolean | undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The callback format for results
|
|
101
|
+
*
|
|
102
|
+
* @param error An error instance representing the error during the execution.
|
|
103
|
+
* @param result The result object if the command was executed successfully.
|
|
104
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#~resultCallback
|
|
105
|
+
*/
|
|
106
|
+
export interface MongoCallback<T> {
|
|
107
|
+
(error: MongoError, result: T): void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A user provided function to be run within a transaction
|
|
111
|
+
*
|
|
112
|
+
* @param session The parent session of the transaction running the operation. This should be passed into each operation within the lambda.
|
|
113
|
+
* @returns Resulting Promise of operations run within this transaction
|
|
114
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#WithTransactionCallback
|
|
115
|
+
*/
|
|
116
|
+
export declare type WithTransactionCallback = (session: ClientSession) => Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Optional settings for MongoClient.connect()
|
|
119
|
+
*
|
|
120
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/MongoClient.html#.connect
|
|
121
|
+
*/
|
|
122
|
+
export interface MongoClientOptions extends DbCreateOptions, ServerOptions, MongosOptions, ReplSetOptions, SocketOptions, SSLOptions, TLSOptions, HighAvailabilityOptions, UnifiedTopologyOptions {
|
|
123
|
+
/**
|
|
124
|
+
* The logging level (error/warn/info/debug)
|
|
125
|
+
*/
|
|
126
|
+
loggerLevel?: string | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Custom logger object
|
|
129
|
+
*/
|
|
130
|
+
logger?: object | log | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Validate MongoClient passed in options for correctness
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
validateOptions?: object | boolean | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* The name of the application that created this MongoClient instance.
|
|
138
|
+
*/
|
|
139
|
+
appname?: string | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Authentication credentials
|
|
142
|
+
*/
|
|
143
|
+
auth?: {
|
|
144
|
+
/**
|
|
145
|
+
* The username for auth
|
|
146
|
+
*/
|
|
147
|
+
user: string;
|
|
148
|
+
/**
|
|
149
|
+
* The password for auth
|
|
150
|
+
*/
|
|
151
|
+
password: string;
|
|
152
|
+
} | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Determines whether or not to use the new url parser. Enables the new, spec-compliant
|
|
155
|
+
* url parser shipped in the core driver. This url parser fixes a number of problems with
|
|
156
|
+
* the original parser, and aims to outright replace that parser in the near future.
|
|
157
|
+
* @default true
|
|
158
|
+
*/
|
|
159
|
+
useNewUrlParser?: boolean | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Number of retries for a tailable cursor
|
|
162
|
+
* @default 5
|
|
163
|
+
*/
|
|
164
|
+
numberOfRetries?: number | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* An authentication mechanism to use for connection authentication,
|
|
167
|
+
* see the {@link https://docs.mongodb.com/v3.6/reference/connection-string/#urioption.authMechanism authMechanism}
|
|
168
|
+
* reference for supported options.
|
|
169
|
+
*/
|
|
170
|
+
authMechanism?: 'DEFAULT' | 'GSSAPI' | 'PLAIN' | 'MONGODB-X509' | 'MONGODB-CR' | 'MONGODB-AWS' | 'SCRAM-SHA-1' | 'SCRAM-SHA-256' | string | undefined;
|
|
171
|
+
/** Type of compression to use */
|
|
172
|
+
compression?: {
|
|
173
|
+
/** The selected compressors in preference order */
|
|
174
|
+
compressors?: Array<'snappy' | 'zlib'> | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Enable directConnection
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
directConnection?: boolean | undefined;
|
|
181
|
+
autoEncryption?: AutoEncryptionOptions | undefined;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Extra options related to the mongocryptd process.
|
|
185
|
+
*
|
|
186
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/AutoEncrypter.html#~AutoEncryptionExtraOptions
|
|
187
|
+
*/
|
|
188
|
+
export interface AutoEncryptionExtraOptions {
|
|
189
|
+
/**
|
|
190
|
+
* A local process the driver communicates with to determine how to encrypt
|
|
191
|
+
* values in a command. Defaults to "mongodb:///var/mongocryptd.sock" if
|
|
192
|
+
* domain sockets are available or "mongodb://localhost:27020" otherwise.
|
|
193
|
+
*/
|
|
194
|
+
mongocryptdURI?: string | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* If true, autoEncryption will not attempt to spawn a mongocryptd before
|
|
197
|
+
* connecting.
|
|
198
|
+
*/
|
|
199
|
+
mongocryptdBypassSpawn?: boolean | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* The path to the mongocryptd executable on the system.
|
|
202
|
+
*/
|
|
203
|
+
mongocryptdSpawnPath?: string | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Command line arguments to use when auto-spawning a mongocryptd.
|
|
206
|
+
*/
|
|
207
|
+
mongocryptdSpawnArgs?: string[] | undefined;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Configuration options that are used by specific KMS providers during key
|
|
211
|
+
* generation, encryption, and decryption.
|
|
212
|
+
*
|
|
213
|
+
* @see http://mongodb.github.io/node-mongodb-native/3.6/api/global.html#KMSProviders
|
|
214
|
+
*/
|
|
215
|
+
export interface KMSProviders {
|
|
216
|
+
/**
|
|
217
|
+
* Configuration options for using 'aws' as your KMS provider.
|
|
218
|
+
*/
|
|
219
|
+
aws?: {
|
|
220
|
+
/**
|
|
221
|
+
* The access key used for the AWS KMS provider.
|
|
222
|
+
*/
|
|
223
|
+
accessKeyId?: string | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* The secret access key used for the AWS KMS provider.
|
|
226
|
+
*/
|
|
227
|
+
secretAccessKey?: string | undefined;
|
|
228
|
+
} | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Configuration options for using `gcp` as your KMS provider.
|
|
231
|
+
*/
|
|
232
|
+
gcp?: {
|
|
233
|
+
/**
|
|
234
|
+
* The service account email to authenticate.
|
|
235
|
+
*/
|
|
236
|
+
email?: string | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* A PKCS#8 encrypted key. This can either be a base64 string or a
|
|
239
|
+
* binary representation.
|
|
240
|
+
*/
|
|
241
|
+
privateKey?: string | Buffer | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* If present, a host with optional port. E.g. "example.com" or
|
|
244
|
+
* "example.com:443". Defaults to "oauth2.googleapis.com".
|
|
245
|
+
*/
|
|
246
|
+
endpoint?: string | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Configuration options for using 'local' as your KMS provider.
|
|
250
|
+
*/
|
|
251
|
+
local?: {
|
|
252
|
+
/**
|
|
253
|
+
* The master key used to encrypt/decrypt data keys. A 96-byte long
|
|
254
|
+
* Buffer.
|
|
255
|
+
*/
|
|
256
|
+
key?: Buffer | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Configuration options for a automatic client encryption.
|
|
261
|
+
*
|
|
262
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/AutoEncrypter.html#~AutoEncryptionOptions
|
|
263
|
+
*/
|
|
264
|
+
export interface AutoEncryptionOptions {
|
|
265
|
+
/**
|
|
266
|
+
* A MongoClient used to fetch keys from a key vault
|
|
267
|
+
*/
|
|
268
|
+
keyVaultClient?: MongoClient | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* The namespace where keys are stored in the key vault.
|
|
271
|
+
*/
|
|
272
|
+
keyVaultNamespace?: string | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Configuration options that are used by specific KMS providers during key
|
|
275
|
+
* generation, encryption, and decryption.
|
|
276
|
+
*/
|
|
277
|
+
kmsProviders?: KMSProviders | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* A map of namespaces to a local JSON schema for encryption.
|
|
280
|
+
*/
|
|
281
|
+
schemaMap?: object | undefined;
|
|
282
|
+
/**
|
|
283
|
+
* Allows the user to bypass auto encryption, maintaining implicit
|
|
284
|
+
* decryption.
|
|
285
|
+
*/
|
|
286
|
+
bypassAutoEncryption?: boolean | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Extra options related to the mongocryptd process.
|
|
289
|
+
*/
|
|
290
|
+
extraOptions?: AutoEncryptionExtraOptions | undefined;
|
|
291
|
+
}
|
|
292
|
+
export interface SSLOptions {
|
|
293
|
+
/**
|
|
294
|
+
* Passed directly through to tls.createSecureContext.
|
|
295
|
+
*
|
|
296
|
+
* @see https://nodejs.org/dist/latest/docs/api/tls.html#tls_tls_createsecurecontext_options
|
|
297
|
+
*/
|
|
298
|
+
ciphers?: string | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Passed directly through to tls.createSecureContext.
|
|
301
|
+
*
|
|
302
|
+
* @see https://nodejs.org/dist/latest/docs/api/tls.html#tls_tls_createsecurecontext_options
|
|
303
|
+
*/
|
|
304
|
+
ecdhCurve?: string | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* Number of connections for each server instance; set to 5 as default for legacy reasons
|
|
307
|
+
* @default 5
|
|
308
|
+
*/
|
|
309
|
+
poolSize?: number | undefined;
|
|
310
|
+
/**
|
|
311
|
+
* If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
|
|
312
|
+
*/
|
|
313
|
+
minSize?: number | undefined;
|
|
314
|
+
/**
|
|
315
|
+
* Use ssl connection (needs to have a mongod server with ssl support)
|
|
316
|
+
*/
|
|
317
|
+
ssl?: boolean | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Validate mongod server certificate against ca (mongod server >=2.4 with ssl support required)
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
322
|
+
sslValidate?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Server identity checking during SSL
|
|
325
|
+
* @default true
|
|
326
|
+
*/
|
|
327
|
+
checkServerIdentity?: boolean | typeof checkServerIdentity | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Array of valid certificates either as Buffers or Strings
|
|
330
|
+
*/
|
|
331
|
+
sslCA?: ReadonlyArray<Buffer | string> | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* SSL Certificate revocation list binary buffer
|
|
334
|
+
*/
|
|
335
|
+
sslCRL?: ReadonlyArray<Buffer | string> | undefined;
|
|
336
|
+
/**
|
|
337
|
+
* SSL Certificate binary buffer
|
|
338
|
+
*/
|
|
339
|
+
sslCert?: Buffer | string | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* SSL Key file binary buffer
|
|
342
|
+
*/
|
|
343
|
+
sslKey?: Buffer | string | undefined;
|
|
344
|
+
/**
|
|
345
|
+
* SSL Certificate pass phrase
|
|
346
|
+
*/
|
|
347
|
+
sslPass?: Buffer | string | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* String containing the server name requested via TLS SNI.
|
|
350
|
+
*/
|
|
351
|
+
servername?: string | undefined;
|
|
352
|
+
}
|
|
353
|
+
export interface TLSOptions {
|
|
354
|
+
/**
|
|
355
|
+
* Enable TLS connections
|
|
356
|
+
* @default false
|
|
357
|
+
*/
|
|
358
|
+
tls?: boolean | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Relax TLS constraints, disabling validation
|
|
361
|
+
* @default false
|
|
362
|
+
*/
|
|
363
|
+
tlsInsecure?: boolean | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* Path to file with either a single or bundle of certificate authorities
|
|
366
|
+
* to be considered trusted when making a TLS connection
|
|
367
|
+
*/
|
|
368
|
+
tlsCAFile?: string | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* Path to the client certificate file or the client private key file;
|
|
371
|
+
* in the case that they both are needed, the files should be concatenated
|
|
372
|
+
*/
|
|
373
|
+
tlsCertificateKeyFile?: string | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* The password to decrypt the client private key to be used for TLS connections
|
|
376
|
+
*/
|
|
377
|
+
tlsCertificateKeyFilePassword?: string | undefined;
|
|
378
|
+
/**
|
|
379
|
+
* Specifies whether or not the driver should error when the server’s TLS certificate is invalid
|
|
380
|
+
*/
|
|
381
|
+
tlsAllowInvalidCertificates?: boolean | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* Specifies whether or not the driver should error when there is a mismatch between the server’s hostname
|
|
384
|
+
* and the hostname specified by the TLS certificate
|
|
385
|
+
*/
|
|
386
|
+
tlsAllowInvalidHostnames?: boolean | undefined;
|
|
387
|
+
}
|
|
388
|
+
export interface HighAvailabilityOptions {
|
|
389
|
+
/**
|
|
390
|
+
* Turn on high availability monitoring
|
|
391
|
+
* @default true
|
|
392
|
+
*/
|
|
393
|
+
ha?: boolean | undefined;
|
|
394
|
+
/**
|
|
395
|
+
* The High availability period for replicaset inquiry
|
|
396
|
+
* @default 10000
|
|
397
|
+
*/
|
|
398
|
+
haInterval?: number | undefined;
|
|
399
|
+
/**
|
|
400
|
+
* @default false
|
|
401
|
+
*/
|
|
402
|
+
domainsEnabled?: boolean | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* The ReadPreference mode as listed
|
|
405
|
+
* {@link https://mongodb.github.io/node-mongodb-native/3.6/api/MongoClient.html here}
|
|
406
|
+
*/
|
|
407
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
408
|
+
/**
|
|
409
|
+
* An object representing read preference tags
|
|
410
|
+
* @see https://docs.mongodb.com/v3.6/core/read-preference-tags/
|
|
411
|
+
*/
|
|
412
|
+
readPreferenceTags?: ReadPreferenceTags | undefined;
|
|
413
|
+
}
|
|
414
|
+
export declare type ReadPreferenceTags = ReadonlyArray<Record<string, string>>;
|
|
415
|
+
export declare type ReadPreferenceMode = 'primary' | 'primaryPreferred' | 'secondary' | 'secondaryPreferred' | 'nearest';
|
|
416
|
+
export declare type ReadPreferenceOrMode = ReadPreference | ReadPreferenceMode;
|
|
417
|
+
export declare type ReadPreferenceOptions = {
|
|
418
|
+
/** Server mode in which the same query is dispatched in parallel to multiple replica set members. */
|
|
419
|
+
hedge?: {
|
|
420
|
+
/** Explicitly enable or disable hedged reads. */
|
|
421
|
+
enabled?: boolean | undefined;
|
|
422
|
+
} | undefined;
|
|
423
|
+
/**
|
|
424
|
+
* Max secondary read staleness in seconds, Minimum value is 90 seconds.
|
|
425
|
+
*/
|
|
426
|
+
maxStalenessSeconds?: number | undefined;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Optional settings for creating a new Db instance
|
|
430
|
+
*
|
|
431
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Db.html
|
|
432
|
+
*/
|
|
433
|
+
export interface DbCreateOptions extends CommonOptions {
|
|
434
|
+
/**
|
|
435
|
+
* If the database authentication is dependent on another databaseName.
|
|
436
|
+
*/
|
|
437
|
+
authSource?: string | undefined;
|
|
438
|
+
/**
|
|
439
|
+
* Force server to assign `_id` fields instead of driver
|
|
440
|
+
* @default false
|
|
441
|
+
*/
|
|
442
|
+
forceServerObjectId?: boolean | undefined;
|
|
443
|
+
/**
|
|
444
|
+
* Use c++ bson parser
|
|
445
|
+
* @default false
|
|
446
|
+
*/
|
|
447
|
+
native_parser?: boolean | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* Serialize functions on any object
|
|
450
|
+
* @default false
|
|
451
|
+
*/
|
|
452
|
+
serializeFunctions?: boolean | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* Specify if the BSON serializer should ignore undefined fields
|
|
455
|
+
* @default false
|
|
456
|
+
*/
|
|
457
|
+
ignoreUndefined?: boolean | undefined;
|
|
458
|
+
/**
|
|
459
|
+
* Return document results as raw BSON buffers
|
|
460
|
+
* @default false
|
|
461
|
+
*/
|
|
462
|
+
raw?: boolean | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Promotes Long values to number if they fit inside the 53 bits resolution
|
|
465
|
+
* @default true
|
|
466
|
+
*/
|
|
467
|
+
promoteLongs?: boolean | undefined;
|
|
468
|
+
/**
|
|
469
|
+
* Promotes Binary BSON values to native Node Buffers
|
|
470
|
+
* @default false
|
|
471
|
+
*/
|
|
472
|
+
promoteBuffers?: boolean | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Promotes BSON values to native types where possible, set to false to only receive wrapper types
|
|
475
|
+
* @default true
|
|
476
|
+
*/
|
|
477
|
+
promoteValues?: boolean | undefined;
|
|
478
|
+
/**
|
|
479
|
+
* The preferred read preference. Use {@link ReadPreference} class.
|
|
480
|
+
*/
|
|
481
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
482
|
+
/**
|
|
483
|
+
* A primary key factory object for generation of custom `_id` keys.
|
|
484
|
+
*/
|
|
485
|
+
pkFactory?: object | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible
|
|
488
|
+
*/
|
|
489
|
+
promiseLibrary?: PromiseConstructor | undefined;
|
|
490
|
+
/**
|
|
491
|
+
* @see https://docs.mongodb.com/v3.6/reference/read-concern/#read-concern
|
|
492
|
+
* @since MongoDB 3.2
|
|
493
|
+
*/
|
|
494
|
+
readConcern?: ReadConcern | string | undefined;
|
|
495
|
+
/**
|
|
496
|
+
* Sets a cap on how many operations the driver will buffer up before giving up on getting a
|
|
497
|
+
* working connection, default is -1 which is unlimited.
|
|
498
|
+
*/
|
|
499
|
+
bufferMaxEntries?: number | undefined;
|
|
500
|
+
}
|
|
501
|
+
export interface UnifiedTopologyOptions {
|
|
502
|
+
/**
|
|
503
|
+
* Enables the new unified topology layer
|
|
504
|
+
*/
|
|
505
|
+
useUnifiedTopology?: boolean | undefined;
|
|
506
|
+
/**
|
|
507
|
+
* **Only applies to the unified topology**
|
|
508
|
+
* The size of the latency window for selecting among multiple suitable servers
|
|
509
|
+
* @default 15
|
|
510
|
+
*/
|
|
511
|
+
localThresholdMS?: number | undefined;
|
|
512
|
+
/**
|
|
513
|
+
* With `useUnifiedTopology`, the MongoDB driver will try to find a server to send any given operation to
|
|
514
|
+
* and keep retrying for `serverSelectionTimeoutMS` milliseconds.
|
|
515
|
+
* @default 30000
|
|
516
|
+
*/
|
|
517
|
+
serverSelectionTimeoutMS?: number | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* **Only applies to the unified topology**
|
|
520
|
+
* The frequency with which topology updates are scheduled
|
|
521
|
+
* @default 10000
|
|
522
|
+
*/
|
|
523
|
+
heartbeatFrequencyMS?: number | undefined;
|
|
524
|
+
/**
|
|
525
|
+
* **Only applies to the unified topology**
|
|
526
|
+
* The maximum number of connections that may be associated with a pool at a given time
|
|
527
|
+
* This includes in use and available connections
|
|
528
|
+
* @default 10
|
|
529
|
+
*/
|
|
530
|
+
maxPoolSize?: number | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* **Only applies to the unified topology**
|
|
533
|
+
* The minimum number of connections that MUST exist at any moment in a single connection pool
|
|
534
|
+
* @default 0
|
|
535
|
+
*/
|
|
536
|
+
minPoolSize?: number | undefined;
|
|
537
|
+
/**
|
|
538
|
+
* **Only applies to the unified topology**
|
|
539
|
+
* The maximum amount of time a connection should remain idle in the connection pool before being marked idle
|
|
540
|
+
* @default Infinity
|
|
541
|
+
*/
|
|
542
|
+
maxIdleTimeMS?: number | undefined;
|
|
543
|
+
/**
|
|
544
|
+
* **Only applies to the unified topology**
|
|
545
|
+
* The maximum amount of time operation execution should wait for a connection to become available.
|
|
546
|
+
* The default is 0 which means there is no limit.
|
|
547
|
+
* @default 0
|
|
548
|
+
*/
|
|
549
|
+
waitQueueTimeoutMS?: number | undefined;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Optional socket options
|
|
553
|
+
*
|
|
554
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Server.html
|
|
555
|
+
*/
|
|
556
|
+
export interface SocketOptions {
|
|
557
|
+
/**
|
|
558
|
+
* Reconnect on error
|
|
559
|
+
* @default true
|
|
560
|
+
*/
|
|
561
|
+
autoReconnect?: boolean | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* TCP Socket NoDelay option
|
|
564
|
+
* @default true
|
|
565
|
+
*/
|
|
566
|
+
noDelay?: boolean | undefined;
|
|
567
|
+
/**
|
|
568
|
+
* TCP KeepAlive enabled on the socket
|
|
569
|
+
* @default true
|
|
570
|
+
*/
|
|
571
|
+
keepAlive?: boolean | undefined;
|
|
572
|
+
/**
|
|
573
|
+
* TCP KeepAlive initial delay before sending first keep-alive packet when idle
|
|
574
|
+
* @default 30000
|
|
575
|
+
*/
|
|
576
|
+
keepAliveInitialDelay?: number | undefined;
|
|
577
|
+
/**
|
|
578
|
+
* TCP Connection timeout setting
|
|
579
|
+
* @default 10000
|
|
580
|
+
*/
|
|
581
|
+
connectTimeoutMS?: number | undefined;
|
|
582
|
+
/**
|
|
583
|
+
* Version of IP stack. Can be 4, 6 or null
|
|
584
|
+
* @default null
|
|
585
|
+
*
|
|
586
|
+
* If null, will attempt to connect with IPv6, and will fall back to IPv4 on failure
|
|
587
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/MongoClient.html
|
|
588
|
+
*/
|
|
589
|
+
family?: 4 | 6 | null | undefined;
|
|
590
|
+
/**
|
|
591
|
+
* TCP Socket timeout setting
|
|
592
|
+
* @default 360000
|
|
593
|
+
*/
|
|
594
|
+
socketTimeoutMS?: number | undefined;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Optional settings for creating a new Server instance
|
|
598
|
+
*
|
|
599
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Server.html
|
|
600
|
+
*/
|
|
601
|
+
export interface ServerOptions extends SSLOptions {
|
|
602
|
+
/**
|
|
603
|
+
* If you're connected to a single server or mongos proxy (as opposed to a replica set),
|
|
604
|
+
* the MongoDB driver will try to reconnect every reconnectInterval milliseconds for reconnectTries
|
|
605
|
+
* times, and give up afterward. When the driver gives up, the mongoose connection emits a
|
|
606
|
+
* reconnectFailed event.
|
|
607
|
+
* @default 30
|
|
608
|
+
*/
|
|
609
|
+
reconnectTries?: number | undefined;
|
|
610
|
+
/**
|
|
611
|
+
* Will wait # milliseconds between retries
|
|
612
|
+
* @default 1000
|
|
613
|
+
*/
|
|
614
|
+
reconnectInterval?: number | undefined;
|
|
615
|
+
/**
|
|
616
|
+
* @default true
|
|
617
|
+
*/
|
|
618
|
+
monitoring?: boolean | undefined;
|
|
619
|
+
/**
|
|
620
|
+
* Enable command monitoring for this client
|
|
621
|
+
* @default false
|
|
622
|
+
*/
|
|
623
|
+
monitorCommands?: boolean | undefined;
|
|
624
|
+
/**
|
|
625
|
+
* Socket Options
|
|
626
|
+
*/
|
|
627
|
+
socketOptions?: SocketOptions | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* The High availability period for replicaset inquiry
|
|
630
|
+
* @default 10000
|
|
631
|
+
*/
|
|
632
|
+
haInterval?: number | undefined;
|
|
633
|
+
/**
|
|
634
|
+
* @default false
|
|
635
|
+
*/
|
|
636
|
+
domainsEnabled?: boolean | undefined;
|
|
637
|
+
/**
|
|
638
|
+
* Specify a file sync write concern
|
|
639
|
+
* @default false
|
|
640
|
+
*/
|
|
641
|
+
fsync?: boolean | undefined;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Optional settings for creating a new Mongos instance
|
|
645
|
+
*
|
|
646
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Mongos.html
|
|
647
|
+
*/
|
|
648
|
+
export interface MongosOptions extends SSLOptions, HighAvailabilityOptions {
|
|
649
|
+
/**
|
|
650
|
+
* Cutoff latency point in MS for MongoS proxy selection
|
|
651
|
+
* @default 15
|
|
652
|
+
*/
|
|
653
|
+
acceptableLatencyMS?: number | undefined;
|
|
654
|
+
/**
|
|
655
|
+
* Socket Options
|
|
656
|
+
*/
|
|
657
|
+
socketOptions?: SocketOptions | undefined;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Optional settings for creating a new ReplSet instance
|
|
661
|
+
*
|
|
662
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/ReplSet.html
|
|
663
|
+
*/
|
|
664
|
+
export interface ReplSetOptions extends SSLOptions, HighAvailabilityOptions {
|
|
665
|
+
/**
|
|
666
|
+
* The max staleness to secondary reads (values under 10 seconds cannot be guaranteed);
|
|
667
|
+
*/
|
|
668
|
+
maxStalenessSeconds?: number | undefined;
|
|
669
|
+
/**
|
|
670
|
+
* The name of the replicaset to connect to.
|
|
671
|
+
*/
|
|
672
|
+
replicaSet?: string | undefined;
|
|
673
|
+
/**
|
|
674
|
+
* Range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
|
|
675
|
+
* @default 15
|
|
676
|
+
*/
|
|
677
|
+
secondaryAcceptableLatencyMS?: number | undefined;
|
|
678
|
+
/**
|
|
679
|
+
* If the driver should connect even if no primary is available
|
|
680
|
+
* @default false
|
|
681
|
+
*/
|
|
682
|
+
connectWithNoPrimary?: boolean | undefined;
|
|
683
|
+
/**
|
|
684
|
+
* Optional socket options
|
|
685
|
+
*
|
|
686
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Server.html
|
|
687
|
+
*/
|
|
688
|
+
socketOptions?: SocketOptions | undefined;
|
|
689
|
+
}
|
|
690
|
+
export declare type ProfilingLevel = 'off' | 'slow_only' | 'all';
|
|
691
|
+
export interface CommonOptions extends WriteConcern {
|
|
692
|
+
session?: ClientSession | undefined;
|
|
693
|
+
writeConcern?: WriteConcern | string | undefined;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Optional settings for adding a user to the database
|
|
697
|
+
*
|
|
698
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Db.html#addUser
|
|
699
|
+
*/
|
|
700
|
+
export interface DbAddUserOptions extends CommonOptions {
|
|
701
|
+
customData?: object | undefined;
|
|
702
|
+
roles?: object[] | undefined;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Options for creating a new collection on a server
|
|
706
|
+
*
|
|
707
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Db.html#createCollection
|
|
708
|
+
*/
|
|
709
|
+
export interface CollectionCreateOptions extends CommonOptions {
|
|
710
|
+
raw?: boolean | undefined;
|
|
711
|
+
pkFactory?: object | undefined;
|
|
712
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
713
|
+
serializeFunctions?: boolean | undefined;
|
|
714
|
+
/**
|
|
715
|
+
* @deprecated
|
|
716
|
+
* @see https://jira.mongodb.org/browse/NODE-2746
|
|
717
|
+
*/
|
|
718
|
+
strict?: boolean | undefined;
|
|
719
|
+
capped?: boolean | undefined;
|
|
720
|
+
/**
|
|
721
|
+
* @deprecated
|
|
722
|
+
*/
|
|
723
|
+
autoIndexId?: boolean | undefined;
|
|
724
|
+
size?: number | undefined;
|
|
725
|
+
max?: number | undefined;
|
|
726
|
+
flags?: number | undefined;
|
|
727
|
+
storageEngine?: object | undefined;
|
|
728
|
+
validator?: object | undefined;
|
|
729
|
+
validationLevel?: 'off' | 'strict' | 'moderate' | undefined;
|
|
730
|
+
validationAction?: 'error' | 'warn' | undefined;
|
|
731
|
+
indexOptionDefaults?: object | undefined;
|
|
732
|
+
viewOn?: string | undefined;
|
|
733
|
+
pipeline?: any[] | undefined;
|
|
734
|
+
collation?: CollationDocument | undefined;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Options for fetching a specific collection.
|
|
738
|
+
*
|
|
739
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Db.html#collection
|
|
740
|
+
*/
|
|
741
|
+
export interface DbCollectionOptions extends CommonOptions {
|
|
742
|
+
raw?: boolean | undefined;
|
|
743
|
+
pkFactory?: object | undefined;
|
|
744
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
745
|
+
serializeFunctions?: boolean | undefined;
|
|
746
|
+
strict?: boolean | undefined;
|
|
747
|
+
readConcern?: ReadConcern | undefined;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Options for creating an index on the db and collection.
|
|
751
|
+
*
|
|
752
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Db.html#createIndex
|
|
753
|
+
*/
|
|
754
|
+
export interface IndexOptions extends CommonOptions {
|
|
755
|
+
/**
|
|
756
|
+
* Creates an unique index.
|
|
757
|
+
*/
|
|
758
|
+
unique?: boolean | undefined;
|
|
759
|
+
/**
|
|
760
|
+
* Creates a sparse index.
|
|
761
|
+
*/
|
|
762
|
+
sparse?: boolean | undefined;
|
|
763
|
+
/**
|
|
764
|
+
* Creates the index in the background, yielding whenever possible.
|
|
765
|
+
*/
|
|
766
|
+
background?: boolean | undefined;
|
|
767
|
+
/**
|
|
768
|
+
* A unique index cannot be created on a key that has pre-existing duplicate values.
|
|
769
|
+
*
|
|
770
|
+
* If you would like to create the index anyway, keeping the first document the database indexes and
|
|
771
|
+
* deleting all subsequent documents that have duplicate value
|
|
772
|
+
*/
|
|
773
|
+
dropDups?: boolean | undefined;
|
|
774
|
+
/**
|
|
775
|
+
* For geo spatial indexes set the lower bound for the co-ordinates.
|
|
776
|
+
*/
|
|
777
|
+
min?: number | undefined;
|
|
778
|
+
/**
|
|
779
|
+
* For geo spatial indexes set the high bound for the co-ordinates.
|
|
780
|
+
*/
|
|
781
|
+
max?: number | undefined;
|
|
782
|
+
/**
|
|
783
|
+
* Specify the format version of the indexes.
|
|
784
|
+
*/
|
|
785
|
+
v?: number | undefined;
|
|
786
|
+
/**
|
|
787
|
+
* Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
|
|
788
|
+
*/
|
|
789
|
+
expireAfterSeconds?: number | undefined;
|
|
790
|
+
/**
|
|
791
|
+
* Override the auto generated index name (useful if the resulting name is larger than 128 bytes)
|
|
792
|
+
*/
|
|
793
|
+
name?: string | undefined;
|
|
794
|
+
/**
|
|
795
|
+
* Creates a partial index based on the given filter object (MongoDB 3.2 or higher)
|
|
796
|
+
*/
|
|
797
|
+
partialFilterExpression?: any;
|
|
798
|
+
collation?: CollationDocument | undefined;
|
|
799
|
+
default_language?: string | undefined;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Create a new Admin instance (INTERNAL TYPE, do not instantiate directly)
|
|
803
|
+
*
|
|
804
|
+
* @returns Collection instance
|
|
805
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html
|
|
806
|
+
*/
|
|
807
|
+
export interface Admin {
|
|
808
|
+
/**
|
|
809
|
+
* Add a user to the database.
|
|
810
|
+
*
|
|
811
|
+
* @param username The username
|
|
812
|
+
* @param password The password
|
|
813
|
+
* @param options Optional settings
|
|
814
|
+
* @param callback The command result callback
|
|
815
|
+
* @returns Promise if no callback is passed
|
|
816
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#addUser
|
|
817
|
+
*/
|
|
818
|
+
addUser(username: string, password: string, callback: MongoCallback<any>): void;
|
|
819
|
+
addUser(username: string, password: string, options?: AddUserOptions): Promise<any>;
|
|
820
|
+
addUser(username: string, password: string, options: AddUserOptions, callback: MongoCallback<any>): void;
|
|
821
|
+
/**
|
|
822
|
+
* Retrieve the server information for the current instance of the db client
|
|
823
|
+
*
|
|
824
|
+
* @param options Optional settings
|
|
825
|
+
* @param callback The command result callback
|
|
826
|
+
* @returns Promise if no callback is passed
|
|
827
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#buildInfo
|
|
828
|
+
*/
|
|
829
|
+
buildInfo(options?: {
|
|
830
|
+
session?: ClientSession | undefined;
|
|
831
|
+
}): Promise<any>;
|
|
832
|
+
buildInfo(options: {
|
|
833
|
+
session?: ClientSession | undefined;
|
|
834
|
+
}, callback: MongoCallback<any>): void;
|
|
835
|
+
buildInfo(callback: MongoCallback<any>): void;
|
|
836
|
+
/**
|
|
837
|
+
* Execute a command
|
|
838
|
+
*
|
|
839
|
+
* @param command The command hash
|
|
840
|
+
* @param options Optional settings
|
|
841
|
+
* @param callback The command result callback
|
|
842
|
+
* @returns Promise if no callback is passed
|
|
843
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#command
|
|
844
|
+
*/
|
|
845
|
+
command(command: object, callback: MongoCallback<any>): void;
|
|
846
|
+
command(command: object, options?: {
|
|
847
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
848
|
+
maxTimeMS?: number | undefined;
|
|
849
|
+
}): Promise<any>;
|
|
850
|
+
command(command: object, options: {
|
|
851
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
852
|
+
maxTimeMS?: number | undefined;
|
|
853
|
+
}, callback: MongoCallback<any>): void;
|
|
854
|
+
/**
|
|
855
|
+
* List the available databases
|
|
856
|
+
*
|
|
857
|
+
* @param options Optional settings
|
|
858
|
+
* @param callback The command result callback
|
|
859
|
+
* @returns Promise if no callback is passed
|
|
860
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#listDatabases
|
|
861
|
+
*/
|
|
862
|
+
listDatabases(options?: {
|
|
863
|
+
nameOnly?: boolean | undefined;
|
|
864
|
+
session?: ClientSession | undefined;
|
|
865
|
+
}): Promise<any>;
|
|
866
|
+
listDatabases(options: {
|
|
867
|
+
nameOnly?: boolean | undefined;
|
|
868
|
+
session?: ClientSession | undefined;
|
|
869
|
+
}, callback: MongoCallback<any>): void;
|
|
870
|
+
listDatabases(callback: MongoCallback<any>): void;
|
|
871
|
+
/**
|
|
872
|
+
* Ping the MongoDB server and retrieve results
|
|
873
|
+
*
|
|
874
|
+
* @param options Optional settings
|
|
875
|
+
* @param callback The command result callback
|
|
876
|
+
* @returns Promise if no callback is passed
|
|
877
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#ping
|
|
878
|
+
*/
|
|
879
|
+
ping(options?: {
|
|
880
|
+
session?: ClientSession | undefined;
|
|
881
|
+
}): Promise<any>;
|
|
882
|
+
ping(options: {
|
|
883
|
+
session?: ClientSession | undefined;
|
|
884
|
+
}, callback: MongoCallback<any>): void;
|
|
885
|
+
ping(callback: MongoCallback<any>): void;
|
|
886
|
+
/**
|
|
887
|
+
* Remove a user from a database
|
|
888
|
+
*
|
|
889
|
+
* @param username The username
|
|
890
|
+
* @param options Optional settings
|
|
891
|
+
* @param callback The command result callback
|
|
892
|
+
* @returns Promise if no callback is passed
|
|
893
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#removeUser
|
|
894
|
+
*/
|
|
895
|
+
removeUser(username: string, callback: MongoCallback<any>): void;
|
|
896
|
+
removeUser(username: string, options?: FSyncOptions): Promise<any>;
|
|
897
|
+
removeUser(username: string, options: FSyncOptions, callback: MongoCallback<any>): void;
|
|
898
|
+
/**
|
|
899
|
+
* Get ReplicaSet status
|
|
900
|
+
*
|
|
901
|
+
* @param options Optional settings
|
|
902
|
+
* @param callback The command result callback
|
|
903
|
+
* @returns Promise if no callback is passed
|
|
904
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#replSetGetStatus
|
|
905
|
+
*/
|
|
906
|
+
replSetGetStatus(options?: {
|
|
907
|
+
session?: ClientSession | undefined;
|
|
908
|
+
}): Promise<any>;
|
|
909
|
+
replSetGetStatus(options: {
|
|
910
|
+
session?: ClientSession | undefined;
|
|
911
|
+
}, callback: MongoCallback<any>): void;
|
|
912
|
+
replSetGetStatus(callback: MongoCallback<any>): void;
|
|
913
|
+
/**
|
|
914
|
+
* Retrieve the server information for the current instance of the db client
|
|
915
|
+
*
|
|
916
|
+
* @param options Optional settings
|
|
917
|
+
* @param callback The command result callback
|
|
918
|
+
* @returns Promise if no callback is passed
|
|
919
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#serverInfo
|
|
920
|
+
*/
|
|
921
|
+
serverInfo(): Promise<any>;
|
|
922
|
+
serverInfo(callback: MongoCallback<any>): void;
|
|
923
|
+
/**
|
|
924
|
+
* Retrieve this db's server status.
|
|
925
|
+
*
|
|
926
|
+
* @param options Optional settings
|
|
927
|
+
* @param callback The command result callback
|
|
928
|
+
* @returns Promise if no callback is passed
|
|
929
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#serverStatus
|
|
930
|
+
*/
|
|
931
|
+
serverStatus(options?: {
|
|
932
|
+
session?: ClientSession | undefined;
|
|
933
|
+
}): Promise<any>;
|
|
934
|
+
serverStatus(options: {
|
|
935
|
+
session?: ClientSession | undefined;
|
|
936
|
+
}, callback: MongoCallback<any>): void;
|
|
937
|
+
serverStatus(callback: MongoCallback<any>): void;
|
|
938
|
+
/**
|
|
939
|
+
* Validate an existing collection
|
|
940
|
+
*
|
|
941
|
+
* @param collectionNme The name of the collection to validate
|
|
942
|
+
* @param options Optional settings
|
|
943
|
+
* @param callback The command result callback
|
|
944
|
+
* @returns Promise if no callback is passed
|
|
945
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#validateCollection
|
|
946
|
+
*/
|
|
947
|
+
validateCollection(collectionNme: string, callback: MongoCallback<any>): void;
|
|
948
|
+
validateCollection(collectionNme: string, options?: object): Promise<any>;
|
|
949
|
+
validateCollection(collectionNme: string, options: object, callback: MongoCallback<any>): void;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Options for adding a user to the database
|
|
953
|
+
*
|
|
954
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#addUser
|
|
955
|
+
*/
|
|
956
|
+
export interface AddUserOptions extends CommonOptions {
|
|
957
|
+
fsync: boolean;
|
|
958
|
+
customData?: object | undefined;
|
|
959
|
+
roles?: object[] | undefined;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Options for removing a user from the database
|
|
963
|
+
*
|
|
964
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Admin.html#removeUser
|
|
965
|
+
*/
|
|
966
|
+
export interface FSyncOptions extends CommonOptions {
|
|
967
|
+
fsync?: boolean | undefined;
|
|
968
|
+
}
|
|
969
|
+
declare type EnhancedOmit<T, K> = string | number extends keyof T ? T : T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
|
970
|
+
declare type ExtractIdType<TSchema> = TSchema extends {
|
|
971
|
+
_id: infer U;
|
|
972
|
+
} ? {} extends U ? Exclude<U, {}> : unknown extends U ? ObjectId : U : ObjectId;
|
|
973
|
+
export declare type OptionalId<TSchema extends {
|
|
974
|
+
_id?: any;
|
|
975
|
+
}> = ObjectId extends TSchema['_id'] ? // a Schema with ObjectId _id type or "any" or "indexed type" provided
|
|
976
|
+
EnhancedOmit<TSchema, '_id'> & {
|
|
977
|
+
_id?: ExtractIdType<TSchema> | undefined;
|
|
978
|
+
} : WithId<TSchema>;
|
|
979
|
+
export declare type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
|
|
980
|
+
_id: ExtractIdType<TSchema>;
|
|
981
|
+
};
|
|
982
|
+
/**
|
|
983
|
+
* Create a new Collection instance (INTERNAL TYPE, do not instantiate directly)
|
|
984
|
+
*
|
|
985
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html
|
|
986
|
+
*/
|
|
987
|
+
export interface Collection<TSchema extends {
|
|
988
|
+
[key: string]: any;
|
|
989
|
+
} = DefaultSchema> {
|
|
990
|
+
/**
|
|
991
|
+
* Get the collection name.
|
|
992
|
+
*/
|
|
993
|
+
collectionName: string;
|
|
994
|
+
/**
|
|
995
|
+
* Get the full collection namespace.
|
|
996
|
+
*/
|
|
997
|
+
namespace: string;
|
|
998
|
+
/**
|
|
999
|
+
* The current write concern values.
|
|
1000
|
+
*/
|
|
1001
|
+
writeConcern: WriteConcern;
|
|
1002
|
+
/**
|
|
1003
|
+
* The current read concern values.
|
|
1004
|
+
*/
|
|
1005
|
+
readConcern: ReadConcern;
|
|
1006
|
+
/**
|
|
1007
|
+
* Get current index hint for collection.
|
|
1008
|
+
*/
|
|
1009
|
+
hint: any;
|
|
1010
|
+
/**
|
|
1011
|
+
* Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2
|
|
1012
|
+
*
|
|
1013
|
+
* @param pipeline Array containing all the aggregation framework commands for the execution
|
|
1014
|
+
* @param options Optional settings
|
|
1015
|
+
* @param callback The command result callback
|
|
1016
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#aggregate
|
|
1017
|
+
*/
|
|
1018
|
+
aggregate<T = TSchema>(callback: MongoCallback<AggregationCursor<T>>): AggregationCursor<T>;
|
|
1019
|
+
aggregate<T = TSchema>(pipeline: object[], callback: MongoCallback<AggregationCursor<T>>): AggregationCursor<T>;
|
|
1020
|
+
aggregate<T = TSchema>(pipeline?: object[], options?: CollectionAggregationOptions, callback?: MongoCallback<AggregationCursor<T>>): AggregationCursor<T>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Perform a bulkWrite operation without a fluent API
|
|
1023
|
+
* If documents passed in do not contain the **_id** field,
|
|
1024
|
+
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
1025
|
+
* can be overridden by setting the **forceServerObjectId** flag.
|
|
1026
|
+
*
|
|
1027
|
+
* @param operations Bulk operations to perform
|
|
1028
|
+
* @param options Optional settings
|
|
1029
|
+
* @param callback The command result callback
|
|
1030
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#bulkWrite
|
|
1031
|
+
*/
|
|
1032
|
+
bulkWrite(operations: Array<BulkWriteOperation<TSchema>>, callback: MongoCallback<BulkWriteOpResultObject>): void;
|
|
1033
|
+
bulkWrite(operations: Array<BulkWriteOperation<TSchema>>, options?: CollectionBulkWriteOptions): Promise<BulkWriteOpResultObject>;
|
|
1034
|
+
bulkWrite(operations: Array<BulkWriteOperation<TSchema>>, options: CollectionBulkWriteOptions, callback: MongoCallback<BulkWriteOpResultObject>): void;
|
|
1035
|
+
/**
|
|
1036
|
+
* An estimated count of matching documents in the db to a query.
|
|
1037
|
+
*
|
|
1038
|
+
* @param query The query for the count
|
|
1039
|
+
* @param options Optional settings
|
|
1040
|
+
* @param callback The command result callback
|
|
1041
|
+
* @returns Promise if no callback is passed
|
|
1042
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#count
|
|
1043
|
+
* @deprecated Use `countDocuments` or `estimatedDocumentCount`
|
|
1044
|
+
*/
|
|
1045
|
+
count(callback: MongoCallback<number>): void;
|
|
1046
|
+
count(query: FilterQuery<TSchema>, callback: MongoCallback<number>): void;
|
|
1047
|
+
count(query?: FilterQuery<TSchema>, options?: MongoCountPreferences): Promise<number>;
|
|
1048
|
+
count(query: FilterQuery<TSchema>, options: MongoCountPreferences, callback: MongoCallback<number>): void;
|
|
1049
|
+
/**
|
|
1050
|
+
* Gets the number of documents matching the filter
|
|
1051
|
+
* For a fast count of the total documents in a collection see `estimatedDocumentCount`.
|
|
1052
|
+
*
|
|
1053
|
+
* @param query The query for the count
|
|
1054
|
+
* @param options Optional settings
|
|
1055
|
+
* @param callback The command result callback
|
|
1056
|
+
* @returns Promise if no callback is passed
|
|
1057
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#countDocuments
|
|
1058
|
+
*/
|
|
1059
|
+
countDocuments(callback: MongoCallback<number>): void;
|
|
1060
|
+
countDocuments(query: FilterQuery<TSchema>, callback: MongoCallback<number>): void;
|
|
1061
|
+
countDocuments(query?: FilterQuery<TSchema>, options?: MongoCountPreferences): Promise<number>;
|
|
1062
|
+
countDocuments(query: FilterQuery<TSchema>, options: MongoCountPreferences, callback: MongoCallback<number>): void;
|
|
1063
|
+
/**
|
|
1064
|
+
* Creates an index on the db and collection collection.
|
|
1065
|
+
*
|
|
1066
|
+
* @param fieldOrSpec Defines the index
|
|
1067
|
+
* @param options Optional settings
|
|
1068
|
+
* @param callback The command result callback
|
|
1069
|
+
* @returns Promise if no callback is passed
|
|
1070
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#createIndex
|
|
1071
|
+
*/
|
|
1072
|
+
createIndex(fieldOrSpec: string | any, callback: MongoCallback<string>): void;
|
|
1073
|
+
createIndex(fieldOrSpec: string | any, options?: IndexOptions): Promise<string>;
|
|
1074
|
+
createIndex(fieldOrSpec: string | any, options: IndexOptions, callback: MongoCallback<string>): void;
|
|
1075
|
+
/**
|
|
1076
|
+
* Creates multiple indexes in the collection, this method is only supported for MongoDB 2.6 or higher.
|
|
1077
|
+
* Earlier version of MongoDB will throw a command not supported error.
|
|
1078
|
+
* **Note:** Unlike `createIndex`, this function takes in raw index specifications.
|
|
1079
|
+
* Index specifications are defined {@link http://docs.mongodb.org/manual/reference/command/createIndexes/ here}.
|
|
1080
|
+
*
|
|
1081
|
+
* @param indexSpecs An array of index specifications to be created
|
|
1082
|
+
* @param options Optional settings
|
|
1083
|
+
* @param callback The command result callback
|
|
1084
|
+
* @returns Promise if no callback is passed
|
|
1085
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#createIndexes
|
|
1086
|
+
*/
|
|
1087
|
+
createIndexes(indexSpecs: IndexSpecification[], callback: MongoCallback<any>): void;
|
|
1088
|
+
createIndexes(indexSpecs: IndexSpecification[], options?: {
|
|
1089
|
+
session?: ClientSession | undefined;
|
|
1090
|
+
}): Promise<any>;
|
|
1091
|
+
createIndexes(indexSpecs: IndexSpecification[], options: {
|
|
1092
|
+
session?: ClientSession | undefined;
|
|
1093
|
+
}, callback: MongoCallback<any>): void;
|
|
1094
|
+
/**
|
|
1095
|
+
* Delete multiple documents from a collection
|
|
1096
|
+
*
|
|
1097
|
+
* @param filter The Filter used to select the documents to remove
|
|
1098
|
+
* @param options Optional settings
|
|
1099
|
+
* @param callback The command result callback
|
|
1100
|
+
* @returns Promise if no callback is passed
|
|
1101
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#deleteMany
|
|
1102
|
+
*/
|
|
1103
|
+
deleteMany(filter: FilterQuery<TSchema>, callback: MongoCallback<DeleteWriteOpResultObject>): void;
|
|
1104
|
+
deleteMany(filter: FilterQuery<TSchema>, options?: CommonOptions): Promise<DeleteWriteOpResultObject>;
|
|
1105
|
+
deleteMany(filter: FilterQuery<TSchema>, options: CommonOptions, callback: MongoCallback<DeleteWriteOpResultObject>): void;
|
|
1106
|
+
/**
|
|
1107
|
+
* Delete a document from a collection
|
|
1108
|
+
*
|
|
1109
|
+
* @param filter The Filter used to select the document to remove
|
|
1110
|
+
* @param options Optional settings
|
|
1111
|
+
* @param callback The command result callback
|
|
1112
|
+
* @returns Promise if no callback is passed
|
|
1113
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#deleteOne
|
|
1114
|
+
*/
|
|
1115
|
+
deleteOne(filter: FilterQuery<TSchema>, callback: MongoCallback<DeleteWriteOpResultObject>): void;
|
|
1116
|
+
deleteOne(filter: FilterQuery<TSchema>, options?: CommonOptions & {
|
|
1117
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
1118
|
+
}): Promise<DeleteWriteOpResultObject>;
|
|
1119
|
+
deleteOne(filter: FilterQuery<TSchema>, options: CommonOptions & {
|
|
1120
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
1121
|
+
}, callback: MongoCallback<DeleteWriteOpResultObject>): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* The distinct command returns a list of distinct values for the given key across a collection.
|
|
1124
|
+
*
|
|
1125
|
+
* @param key Field of the document to find distinct values for.
|
|
1126
|
+
* @param query The optional query for filtering the set of documents to which we apply the distinct filter.
|
|
1127
|
+
* @param options Optional settings
|
|
1128
|
+
* @param callback The command result callback
|
|
1129
|
+
* @returns Promise if no callback is passed
|
|
1130
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#distinct
|
|
1131
|
+
*/
|
|
1132
|
+
distinct<Key extends keyof WithId<TSchema>>(key: Key, callback: MongoCallback<Array<FlattenIfArray<WithId<Required<TSchema>>[Key]>>>): void;
|
|
1133
|
+
distinct<Key extends keyof WithId<TSchema>>(key: Key, query: FilterQuery<TSchema>, callback: MongoCallback<Array<FlattenIfArray<WithId<Required<TSchema>>[Key]>>>): void;
|
|
1134
|
+
distinct<Key extends keyof WithId<TSchema>>(key: Key, query?: FilterQuery<TSchema>, options?: MongoDistinctPreferences): Promise<Array<FlattenIfArray<WithId<Required<TSchema>>[Key]>>>;
|
|
1135
|
+
distinct<Key extends keyof WithId<TSchema>>(key: Key, query: FilterQuery<TSchema>, options: MongoDistinctPreferences, callback: MongoCallback<Array<FlattenIfArray<WithId<Required<TSchema>>[Key]>>>): void;
|
|
1136
|
+
distinct(key: string, callback: MongoCallback<any[]>): void;
|
|
1137
|
+
distinct(key: string, query: FilterQuery<TSchema>, callback: MongoCallback<any[]>): void;
|
|
1138
|
+
distinct(key: string, query?: FilterQuery<TSchema>, options?: MongoDistinctPreferences): Promise<any[]>;
|
|
1139
|
+
distinct(key: string, query: FilterQuery<TSchema>, options: MongoDistinctPreferences, callback: MongoCallback<any[]>): void;
|
|
1140
|
+
/**
|
|
1141
|
+
* Drop the collection from the database, removing it permanently. New accesses will create a new collection.
|
|
1142
|
+
*
|
|
1143
|
+
* @param options Optional settings
|
|
1144
|
+
* @param callback The command result callback
|
|
1145
|
+
* @returns Promise if no callback is passed
|
|
1146
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#drop
|
|
1147
|
+
*/
|
|
1148
|
+
drop(options?: {
|
|
1149
|
+
session: ClientSession;
|
|
1150
|
+
}): Promise<any>;
|
|
1151
|
+
drop(callback: MongoCallback<any>): void;
|
|
1152
|
+
drop(options: {
|
|
1153
|
+
session: ClientSession;
|
|
1154
|
+
}, callback: MongoCallback<any>): void;
|
|
1155
|
+
/**
|
|
1156
|
+
* Drops an index from this collection.
|
|
1157
|
+
*
|
|
1158
|
+
* @param indexName Name of the index to drop.
|
|
1159
|
+
* @param options Optional settings
|
|
1160
|
+
* @param callback The command result callback
|
|
1161
|
+
* @returns Promise if no callback is passed
|
|
1162
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#dropIndex
|
|
1163
|
+
*/
|
|
1164
|
+
dropIndex(indexName: string, callback: MongoCallback<any>): void;
|
|
1165
|
+
dropIndex(indexName: string, options?: CommonOptions & {
|
|
1166
|
+
maxTimeMS?: number | undefined;
|
|
1167
|
+
}): Promise<any>;
|
|
1168
|
+
dropIndex(indexName: string, options: CommonOptions & {
|
|
1169
|
+
maxTimeMS?: number | undefined;
|
|
1170
|
+
}, callback: MongoCallback<any>): void;
|
|
1171
|
+
/**
|
|
1172
|
+
* Drops all indexes from this collection.
|
|
1173
|
+
*
|
|
1174
|
+
* @param options Optional settings
|
|
1175
|
+
* @param callback The command result callback
|
|
1176
|
+
* @returns Promise if no callback is passed
|
|
1177
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#dropIndexes
|
|
1178
|
+
*/
|
|
1179
|
+
dropIndexes(options?: {
|
|
1180
|
+
session?: ClientSession | undefined;
|
|
1181
|
+
maxTimeMS?: number | undefined;
|
|
1182
|
+
}): Promise<any>;
|
|
1183
|
+
dropIndexes(callback?: MongoCallback<any>): void;
|
|
1184
|
+
dropIndexes(options: {
|
|
1185
|
+
session?: ClientSession | undefined;
|
|
1186
|
+
maxTimeMS?: number | undefined;
|
|
1187
|
+
}, callback: MongoCallback<any>): void;
|
|
1188
|
+
/**
|
|
1189
|
+
* Gets an estimate of the count of documents in a collection using collection metadata.
|
|
1190
|
+
*
|
|
1191
|
+
* @param options Optional settings
|
|
1192
|
+
* @param callback The command result callback
|
|
1193
|
+
* @returns Promise if no callback is passed
|
|
1194
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#estimatedDocumentCount
|
|
1195
|
+
*/
|
|
1196
|
+
estimatedDocumentCount(callback: MongoCallback<number>): void;
|
|
1197
|
+
estimatedDocumentCount(query: FilterQuery<TSchema>, callback: MongoCallback<number>): void;
|
|
1198
|
+
estimatedDocumentCount(query?: FilterQuery<TSchema>, options?: MongoCountPreferences): Promise<number>;
|
|
1199
|
+
estimatedDocumentCount(query: FilterQuery<TSchema>, options: MongoCountPreferences, callback: MongoCallback<number>): void;
|
|
1200
|
+
/**
|
|
1201
|
+
* Creates a cursor for a query that can be used to iterate over results from MongoDB
|
|
1202
|
+
*
|
|
1203
|
+
* @param query The cursor query object
|
|
1204
|
+
* @param options Optional settings
|
|
1205
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#find
|
|
1206
|
+
*/
|
|
1207
|
+
find(query?: FilterQuery<TSchema>): Cursor<TSchema>;
|
|
1208
|
+
find(query: FilterQuery<TSchema>, options?: WithoutProjection<FindOneOptions<TSchema>>): Cursor<TSchema>;
|
|
1209
|
+
find<T = TSchema>(query: FilterQuery<TSchema>, options: FindOneOptions<T extends TSchema ? TSchema : T>): Cursor<T>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Fetches the first document that matches the query
|
|
1212
|
+
*
|
|
1213
|
+
* @param query Query for find Operation
|
|
1214
|
+
* @param options Optional settings
|
|
1215
|
+
* @param callback The command result callback
|
|
1216
|
+
* @returns Promise if no callback is passed
|
|
1217
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne
|
|
1218
|
+
*/
|
|
1219
|
+
findOne(filter: FilterQuery<TSchema>, callback: MongoCallback<TSchema>): void;
|
|
1220
|
+
findOne(filter: FilterQuery<TSchema>, options?: WithoutProjection<FindOneOptions<TSchema>>): Promise<TSchema | null>;
|
|
1221
|
+
findOne<T = TSchema>(filter: FilterQuery<TSchema>, options?: FindOneOptions<T extends TSchema ? TSchema : T>): Promise<T | null>;
|
|
1222
|
+
findOne(filter: FilterQuery<TSchema>, options: WithoutProjection<FindOneOptions<TSchema>>, callback: MongoCallback<TSchema | null>): void;
|
|
1223
|
+
findOne<T = TSchema>(filter: FilterQuery<TSchema>, options: FindOneOptions<T extends TSchema ? TSchema : T>, callback: MongoCallback<T extends TSchema ? TSchema : T | null>): void;
|
|
1224
|
+
/**
|
|
1225
|
+
* Find a document and delete it in one atomic operation. Requires a write lock for the duration of the operation.
|
|
1226
|
+
*
|
|
1227
|
+
* @param filter The Filter used to select the document to remove
|
|
1228
|
+
* @param options Optional settings
|
|
1229
|
+
* @param callback The command result callback
|
|
1230
|
+
* @returns Promise if no callback is passed
|
|
1231
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndDelete
|
|
1232
|
+
*/
|
|
1233
|
+
findOneAndDelete(filter: FilterQuery<TSchema>, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1234
|
+
findOneAndDelete(filter: FilterQuery<TSchema>, options?: FindOneAndDeleteOption<TSchema>): Promise<FindAndModifyWriteOpResultObject<TSchema>>;
|
|
1235
|
+
findOneAndDelete(filter: FilterQuery<TSchema>, options: FindOneAndDeleteOption<TSchema>, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1236
|
+
/**
|
|
1237
|
+
* Find a document and replace it in one atomic operation. Requires a write lock for the duration of the operation.
|
|
1238
|
+
*
|
|
1239
|
+
* @param filter The Filter used to select the document to replace
|
|
1240
|
+
* @param replacement The Document that replaces the matching document
|
|
1241
|
+
* @param options Optional settings
|
|
1242
|
+
* @param callback The command result callback
|
|
1243
|
+
* @returns Promise if no callback is passed
|
|
1244
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndReplace
|
|
1245
|
+
*/
|
|
1246
|
+
findOneAndReplace(filter: FilterQuery<TSchema>, replacement: object, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1247
|
+
findOneAndReplace(filter: FilterQuery<TSchema>, replacement: object, options?: FindOneAndReplaceOption<TSchema>): Promise<FindAndModifyWriteOpResultObject<TSchema>>;
|
|
1248
|
+
findOneAndReplace(filter: FilterQuery<TSchema>, replacement: object, options: FindOneAndReplaceOption<TSchema>, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1249
|
+
/**
|
|
1250
|
+
* Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation.
|
|
1251
|
+
*
|
|
1252
|
+
* @param filter The Filter used to select the document to update
|
|
1253
|
+
* @param update Update operations to be performed on the document
|
|
1254
|
+
* @param options Optional settings
|
|
1255
|
+
* @param callback The command result callback
|
|
1256
|
+
* @returns Promise if no callback is passed
|
|
1257
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndUpdate
|
|
1258
|
+
*/
|
|
1259
|
+
findOneAndUpdate(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | TSchema, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1260
|
+
findOneAndUpdate(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | TSchema, options?: FindOneAndUpdateOption<TSchema>): Promise<FindAndModifyWriteOpResultObject<TSchema>>;
|
|
1261
|
+
findOneAndUpdate(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | TSchema, options: FindOneAndUpdateOption<TSchema>, callback: MongoCallback<FindAndModifyWriteOpResultObject<TSchema>>): void;
|
|
1262
|
+
/**
|
|
1263
|
+
* Execute a geo search using a geo haystack index on a collection.
|
|
1264
|
+
*
|
|
1265
|
+
* @param x Point to search on the x axis, ensure the indexes are ordered in the same order.
|
|
1266
|
+
* @param y Point to search on the y axis, ensure the indexes are ordered in the same order.
|
|
1267
|
+
* @param options Optional settings
|
|
1268
|
+
* @param callback The command result callback
|
|
1269
|
+
* @returns Promise if no callback is passed
|
|
1270
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#geoHaystackSearch
|
|
1271
|
+
* @deprecated See {@link https://docs.mongodb.com/v3.6/geospatial-queries/ geospatial queries docs} for current geospatial support
|
|
1272
|
+
*/
|
|
1273
|
+
geoHaystackSearch(x: number, y: number, callback: MongoCallback<any>): void;
|
|
1274
|
+
geoHaystackSearch(x: number, y: number, options?: GeoHaystackSearchOptions): Promise<any>;
|
|
1275
|
+
geoHaystackSearch(x: number, y: number, options: GeoHaystackSearchOptions, callback: MongoCallback<any>): void;
|
|
1276
|
+
/**
|
|
1277
|
+
* Run a group command across a collection
|
|
1278
|
+
*
|
|
1279
|
+
* @param keys An object, array or function expressing the keys to group by.
|
|
1280
|
+
* @param condition An optional condition that must be true for a row to be considered.
|
|
1281
|
+
* @param initial Initial value of the aggregation counter object.
|
|
1282
|
+
* @param reduce The reduce function aggregates (reduces) the objects iterated.
|
|
1283
|
+
* @param finalize An optional function to be run on each item in the result set just before the item is returned.
|
|
1284
|
+
* @param command Specify if you wish to run using the internal group command or using eval, default is true.
|
|
1285
|
+
* @param options Optional settings
|
|
1286
|
+
* @param callback The command result callback
|
|
1287
|
+
* @returns Promise if no callback is passed
|
|
1288
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#group
|
|
1289
|
+
* @deprecated MongoDB 3.6 or higher no longer supports the group command. We recommend rewriting using the aggregation framework.
|
|
1290
|
+
*/
|
|
1291
|
+
group(keys: object | any[] | Function | Code, condition: object, initial: object, reduce: Function | Code, finalize: Function | Code, command: boolean, callback: MongoCallback<any>): void;
|
|
1292
|
+
group(keys: object | any[] | Function | Code, condition: object, initial: object, reduce: Function | Code, finalize: Function | Code, command: boolean, options?: {
|
|
1293
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
1294
|
+
session?: ClientSession | undefined;
|
|
1295
|
+
}): Promise<any>;
|
|
1296
|
+
group(keys: object | any[] | Function | Code, condition: object, initial: object, reduce: Function | Code, finalize: Function | Code, command: boolean, options: {
|
|
1297
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
1298
|
+
session?: ClientSession | undefined;
|
|
1299
|
+
}, callback: MongoCallback<any>): void;
|
|
1300
|
+
/**
|
|
1301
|
+
* Retrieve all the indexes on the collection.
|
|
1302
|
+
*
|
|
1303
|
+
* @param options Optional settings
|
|
1304
|
+
* @param callback The command result callback
|
|
1305
|
+
* @returns Promise if no callback is passed
|
|
1306
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#indexes
|
|
1307
|
+
*/
|
|
1308
|
+
indexes(options?: {
|
|
1309
|
+
session: ClientSession;
|
|
1310
|
+
}): Promise<any>;
|
|
1311
|
+
indexes(callback: MongoCallback<any>): void;
|
|
1312
|
+
indexes(options: {
|
|
1313
|
+
session?: ClientSession | undefined;
|
|
1314
|
+
}, callback: MongoCallback<any>): void;
|
|
1315
|
+
/**
|
|
1316
|
+
* Checks if one or more indexes exist on the collection, fails on first non-existing index
|
|
1317
|
+
*
|
|
1318
|
+
* @param indexes One or more index names to check.
|
|
1319
|
+
* @param options Optional settings
|
|
1320
|
+
* @param callback The command result callback
|
|
1321
|
+
* @returns Promise if no callback is passed
|
|
1322
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#indexExists
|
|
1323
|
+
*/
|
|
1324
|
+
indexExists(indexes: string | string[], callback: MongoCallback<boolean>): void;
|
|
1325
|
+
indexExists(indexes: string | string[], options?: {
|
|
1326
|
+
session: ClientSession;
|
|
1327
|
+
}): Promise<boolean>;
|
|
1328
|
+
indexExists(indexes: string | string[], options: {
|
|
1329
|
+
session: ClientSession;
|
|
1330
|
+
}, callback: MongoCallback<boolean>): void;
|
|
1331
|
+
/**
|
|
1332
|
+
* Retrieves this collections index info.
|
|
1333
|
+
*
|
|
1334
|
+
* @param options Optional settings
|
|
1335
|
+
* @param callback The command result callback
|
|
1336
|
+
* @returns Promise if no callback is passed
|
|
1337
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#indexInformation
|
|
1338
|
+
*/
|
|
1339
|
+
indexInformation(callback: MongoCallback<any>): void;
|
|
1340
|
+
indexInformation(options?: {
|
|
1341
|
+
full: boolean;
|
|
1342
|
+
session: ClientSession;
|
|
1343
|
+
}): Promise<any>;
|
|
1344
|
+
indexInformation(options: {
|
|
1345
|
+
full: boolean;
|
|
1346
|
+
session: ClientSession;
|
|
1347
|
+
}, callback: MongoCallback<any>): void;
|
|
1348
|
+
/**
|
|
1349
|
+
* Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types.
|
|
1350
|
+
*
|
|
1351
|
+
* @param options Optional settings
|
|
1352
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#initializeOrderedBulkOp
|
|
1353
|
+
*/
|
|
1354
|
+
initializeOrderedBulkOp(options?: CommonOptions): OrderedBulkOperation;
|
|
1355
|
+
/**
|
|
1356
|
+
* Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
|
|
1357
|
+
*
|
|
1358
|
+
* @param options Optional settings
|
|
1359
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#initializeUnorderedBulkOp
|
|
1360
|
+
*/
|
|
1361
|
+
initializeUnorderedBulkOp(options?: CommonOptions): UnorderedBulkOperation;
|
|
1362
|
+
/**
|
|
1363
|
+
* Inserts a single document or a an array of documents into MongoDB. If documents passed in do not contain the **_id** field,
|
|
1364
|
+
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
1365
|
+
* can be overridden by setting the **forceServerObjectId** flag.
|
|
1366
|
+
*
|
|
1367
|
+
* @param docs Documents to insert.
|
|
1368
|
+
* @param options Optional settings
|
|
1369
|
+
* @param callback The command result callback
|
|
1370
|
+
* @returns Promise if no callback is passed
|
|
1371
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#insert
|
|
1372
|
+
* @deprecated Use insertOne, insertMany or bulkWrite
|
|
1373
|
+
*/
|
|
1374
|
+
insert(docs: OptionalId<TSchema>, callback: MongoCallback<InsertWriteOpResult<WithId<TSchema>>>): void;
|
|
1375
|
+
insert(docs: OptionalId<TSchema>, options?: CollectionInsertOneOptions): Promise<InsertWriteOpResult<WithId<TSchema>>>;
|
|
1376
|
+
insert(docs: OptionalId<TSchema>, options: CollectionInsertOneOptions, callback: MongoCallback<InsertWriteOpResult<WithId<TSchema>>>): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* Inserts an array of documents into MongoDB. If documents passed in do not contain the **_id** field,
|
|
1379
|
+
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
1380
|
+
* can be overridden by setting the **forceServerObjectId** flag.
|
|
1381
|
+
*
|
|
1382
|
+
* @param docs Documents to insert.
|
|
1383
|
+
* @param options Optional settings
|
|
1384
|
+
* @param callback The command result callback
|
|
1385
|
+
* @returns Promise if no callback is passed
|
|
1386
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#insertMany
|
|
1387
|
+
*/
|
|
1388
|
+
insertMany(docs: Array<OptionalId<TSchema>>, callback: MongoCallback<InsertWriteOpResult<WithId<TSchema>>>): void;
|
|
1389
|
+
insertMany(docs: Array<OptionalId<TSchema>>, options?: CollectionInsertManyOptions): Promise<InsertWriteOpResult<WithId<TSchema>>>;
|
|
1390
|
+
insertMany(docs: Array<OptionalId<TSchema>>, options: CollectionInsertManyOptions, callback: MongoCallback<InsertWriteOpResult<WithId<TSchema>>>): void;
|
|
1391
|
+
/**
|
|
1392
|
+
* Inserts a single document into MongoDB. If documents passed in do not contain the **_id** field,
|
|
1393
|
+
* one will be added to each of the documents missing it by the driver, mutating the document. This behavior
|
|
1394
|
+
* can be overridden by setting the **forceServerObjectId** flag.
|
|
1395
|
+
*
|
|
1396
|
+
* @param doc Document to insert.
|
|
1397
|
+
* @param options Optional settings
|
|
1398
|
+
* @param callback The command result callback
|
|
1399
|
+
* @returns Promise if no callback is passed
|
|
1400
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#insertOne
|
|
1401
|
+
*/
|
|
1402
|
+
insertOne(docs: OptionalId<TSchema>, callback: MongoCallback<InsertOneWriteOpResult<WithId<TSchema>>>): void;
|
|
1403
|
+
insertOne(docs: OptionalId<TSchema>, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult<WithId<TSchema>>>;
|
|
1404
|
+
insertOne(docs: OptionalId<TSchema>, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult<WithId<TSchema>>>): void;
|
|
1405
|
+
/**
|
|
1406
|
+
* Returns if the collection is a capped collection
|
|
1407
|
+
*
|
|
1408
|
+
* @param options Optional settings
|
|
1409
|
+
* @param callback The command result callback
|
|
1410
|
+
* @returns Promise if no callback is passed
|
|
1411
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#isCapped
|
|
1412
|
+
*/
|
|
1413
|
+
isCapped(options?: {
|
|
1414
|
+
session: ClientSession;
|
|
1415
|
+
}): Promise<any>;
|
|
1416
|
+
isCapped(callback: MongoCallback<any>): void;
|
|
1417
|
+
isCapped(options: {
|
|
1418
|
+
session: ClientSession;
|
|
1419
|
+
}, callback: MongoCallback<any>): void;
|
|
1420
|
+
/**
|
|
1421
|
+
* Get the list of all indexes information for the collection.
|
|
1422
|
+
*
|
|
1423
|
+
* @param options Optional settings
|
|
1424
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#listIndexes
|
|
1425
|
+
*/
|
|
1426
|
+
listIndexes(options?: {
|
|
1427
|
+
batchSize?: number | undefined;
|
|
1428
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
1429
|
+
session?: ClientSession | undefined;
|
|
1430
|
+
}): CommandCursor;
|
|
1431
|
+
/**
|
|
1432
|
+
* Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
|
|
1433
|
+
*
|
|
1434
|
+
* @param map The mapping function.
|
|
1435
|
+
* @param reduce The reduce function.
|
|
1436
|
+
* @param options Optional settings
|
|
1437
|
+
* @param callback The command result callback
|
|
1438
|
+
* @returns Promise if no callback is passed
|
|
1439
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#mapReduce
|
|
1440
|
+
*/
|
|
1441
|
+
mapReduce<TKey, TValue>(map: CollectionMapFunction<TSchema> | string, reduce: CollectionReduceFunction<TKey, TValue> | string, callback: MongoCallback<any>): void;
|
|
1442
|
+
mapReduce<TKey, TValue>(map: CollectionMapFunction<TSchema> | string, reduce: CollectionReduceFunction<TKey, TValue> | string, options?: MapReduceOptions): Promise<any>;
|
|
1443
|
+
mapReduce<TKey, TValue>(map: CollectionMapFunction<TSchema> | string, reduce: CollectionReduceFunction<TKey, TValue> | string, options: MapReduceOptions, callback: MongoCallback<any>): void;
|
|
1444
|
+
/**
|
|
1445
|
+
* Returns the options of the collection.
|
|
1446
|
+
*
|
|
1447
|
+
* @param options Optional settings
|
|
1448
|
+
* @param callback The command result callback
|
|
1449
|
+
* @returns Promise if no callback is passed
|
|
1450
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#options
|
|
1451
|
+
*/
|
|
1452
|
+
options(options?: {
|
|
1453
|
+
session: ClientSession;
|
|
1454
|
+
}): Promise<any>;
|
|
1455
|
+
options(callback: MongoCallback<any>): void;
|
|
1456
|
+
options(options: {
|
|
1457
|
+
session: ClientSession;
|
|
1458
|
+
}, callback: MongoCallback<any>): void;
|
|
1459
|
+
/**
|
|
1460
|
+
* Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are
|
|
1461
|
+
* no ordering guarantees for returned results.
|
|
1462
|
+
*
|
|
1463
|
+
* @param options Optional settings
|
|
1464
|
+
* @param callback The command result callback
|
|
1465
|
+
* @returns Promise if no callback is passed
|
|
1466
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#parallelCollectionScan
|
|
1467
|
+
*/
|
|
1468
|
+
parallelCollectionScan(callback: MongoCallback<Array<Cursor<any>>>): void;
|
|
1469
|
+
parallelCollectionScan(options?: ParallelCollectionScanOptions): Promise<Array<Cursor<any>>>;
|
|
1470
|
+
parallelCollectionScan(options: ParallelCollectionScanOptions, callback: MongoCallback<Array<Cursor<any>>>): void;
|
|
1471
|
+
/**
|
|
1472
|
+
* Reindex all indexes on the collection
|
|
1473
|
+
* Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
|
|
1474
|
+
*
|
|
1475
|
+
* @param options Optional settings
|
|
1476
|
+
* @param callback The command result callback
|
|
1477
|
+
* @returns Promise if no callback is passed
|
|
1478
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#reIndex
|
|
1479
|
+
* @deprecated use db.command instead
|
|
1480
|
+
*/
|
|
1481
|
+
reIndex(options?: {
|
|
1482
|
+
session: ClientSession;
|
|
1483
|
+
}): Promise<any>;
|
|
1484
|
+
reIndex(callback: MongoCallback<any>): void;
|
|
1485
|
+
reIndex(options: {
|
|
1486
|
+
session: ClientSession;
|
|
1487
|
+
}, callback: MongoCallback<any>): void;
|
|
1488
|
+
/**
|
|
1489
|
+
* Remove documents.
|
|
1490
|
+
*
|
|
1491
|
+
* @param selector The selector for the update operation.
|
|
1492
|
+
* @param options Optional settings
|
|
1493
|
+
* @param callback The command result callback
|
|
1494
|
+
* @returns Promise if no callback is passed
|
|
1495
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#remove
|
|
1496
|
+
* @deprecated Use use deleteOne, deleteMany or bulkWrite
|
|
1497
|
+
*/
|
|
1498
|
+
remove(selector: object, callback: MongoCallback<WriteOpResult>): void;
|
|
1499
|
+
remove(selector: object, options?: CommonOptions & {
|
|
1500
|
+
single?: boolean | undefined;
|
|
1501
|
+
}): Promise<WriteOpResult>;
|
|
1502
|
+
remove(selector: object, options?: CommonOptions & {
|
|
1503
|
+
single?: boolean | undefined;
|
|
1504
|
+
}, callback?: MongoCallback<WriteOpResult>): void;
|
|
1505
|
+
/**
|
|
1506
|
+
* Rename the collection
|
|
1507
|
+
*
|
|
1508
|
+
* @param newName New name of of the collection.
|
|
1509
|
+
* @param options Optional settings
|
|
1510
|
+
* @param callback The command result callback
|
|
1511
|
+
* @returns Promise if no callback is passed
|
|
1512
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#rename
|
|
1513
|
+
*/
|
|
1514
|
+
rename(newName: string, callback: MongoCallback<Collection<TSchema>>): void;
|
|
1515
|
+
rename(newName: string, options?: {
|
|
1516
|
+
dropTarget?: boolean | undefined;
|
|
1517
|
+
session?: ClientSession | undefined;
|
|
1518
|
+
}): Promise<Collection<TSchema>>;
|
|
1519
|
+
rename(newName: string, options: {
|
|
1520
|
+
dropTarget?: boolean | undefined;
|
|
1521
|
+
session?: ClientSession | undefined;
|
|
1522
|
+
}, callback: MongoCallback<Collection<TSchema>>): void;
|
|
1523
|
+
/**
|
|
1524
|
+
* Replace a document in a collection with another document
|
|
1525
|
+
*
|
|
1526
|
+
* @param filter The Filter used to select the document to replace
|
|
1527
|
+
* @param doc The Document that replaces the matching document
|
|
1528
|
+
* @param options Optional settings
|
|
1529
|
+
* @param callback The command result callback
|
|
1530
|
+
* @returns Promise if no callback is passed
|
|
1531
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#replaceOne
|
|
1532
|
+
*/
|
|
1533
|
+
replaceOne(filter: FilterQuery<TSchema>, doc: TSchema, callback: MongoCallback<ReplaceWriteOpResult>): void;
|
|
1534
|
+
replaceOne(filter: FilterQuery<TSchema>, doc: TSchema, options?: ReplaceOneOptions): Promise<ReplaceWriteOpResult>;
|
|
1535
|
+
replaceOne(filter: FilterQuery<TSchema>, doc: TSchema, options: ReplaceOneOptions, callback: MongoCallback<ReplaceWriteOpResult>): void;
|
|
1536
|
+
/**
|
|
1537
|
+
* Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic
|
|
1538
|
+
* operators and update instead for more efficient operations.
|
|
1539
|
+
*
|
|
1540
|
+
* @param doc Document to save
|
|
1541
|
+
* @param options Optional settings
|
|
1542
|
+
* @param callback The command result callback
|
|
1543
|
+
* @returns Promise if no callback is passed
|
|
1544
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#save
|
|
1545
|
+
* @deprecated Use insertOne, insertMany, updateOne or updateMany
|
|
1546
|
+
*/
|
|
1547
|
+
save(doc: TSchema, callback: MongoCallback<WriteOpResult>): void;
|
|
1548
|
+
save(doc: TSchema, options?: CommonOptions): Promise<WriteOpResult>;
|
|
1549
|
+
save(doc: TSchema, options: CommonOptions, callback: MongoCallback<WriteOpResult>): void;
|
|
1550
|
+
/**
|
|
1551
|
+
* Get all the collection statistics.
|
|
1552
|
+
*
|
|
1553
|
+
* @param options Optional settings
|
|
1554
|
+
* @param callback The command result callback
|
|
1555
|
+
* @returns Promise if no callback is passed
|
|
1556
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#stats
|
|
1557
|
+
*/
|
|
1558
|
+
stats(callback: MongoCallback<CollStats>): void;
|
|
1559
|
+
stats(options?: {
|
|
1560
|
+
scale: number;
|
|
1561
|
+
session?: ClientSession | undefined;
|
|
1562
|
+
}): Promise<CollStats>;
|
|
1563
|
+
stats(options: {
|
|
1564
|
+
scale: number;
|
|
1565
|
+
session?: ClientSession | undefined;
|
|
1566
|
+
}, callback: MongoCallback<CollStats>): void;
|
|
1567
|
+
/**
|
|
1568
|
+
* Updates documents
|
|
1569
|
+
*
|
|
1570
|
+
* @param selector The selector for the update operation.
|
|
1571
|
+
* @param update The update operations to be applied to the documents
|
|
1572
|
+
* @param options Optional settings
|
|
1573
|
+
* @param callback The command result callback
|
|
1574
|
+
* @returns Promise if no callback is passed
|
|
1575
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#update
|
|
1576
|
+
* @deprecated use updateOne, updateMany or bulkWrite
|
|
1577
|
+
*/
|
|
1578
|
+
update(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, callback: MongoCallback<WriteOpResult>): void;
|
|
1579
|
+
update(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options?: UpdateOneOptions & {
|
|
1580
|
+
multi?: boolean | undefined;
|
|
1581
|
+
}): Promise<WriteOpResult>;
|
|
1582
|
+
update(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options: UpdateOneOptions & {
|
|
1583
|
+
multi?: boolean | undefined;
|
|
1584
|
+
}, callback: MongoCallback<WriteOpResult>): void;
|
|
1585
|
+
/**
|
|
1586
|
+
* Update multiple documents in a collection
|
|
1587
|
+
*
|
|
1588
|
+
* @param filter The Filter used to select the documents to update
|
|
1589
|
+
* @param update The update operations to be applied to the documents
|
|
1590
|
+
* @param options Optional settings
|
|
1591
|
+
* @param callback The command result callback
|
|
1592
|
+
* @returns Promise if no callback is passed
|
|
1593
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#updateMany
|
|
1594
|
+
*/
|
|
1595
|
+
updateMany(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, callback: MongoCallback<UpdateWriteOpResult>): void;
|
|
1596
|
+
updateMany(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options?: UpdateManyOptions): Promise<UpdateWriteOpResult>;
|
|
1597
|
+
updateMany(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options: UpdateManyOptions, callback: MongoCallback<UpdateWriteOpResult>): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* Update a single document in a collection
|
|
1600
|
+
*
|
|
1601
|
+
* @param filter The Filter used to select the document to update
|
|
1602
|
+
* @param update The update operations to be applied to the document
|
|
1603
|
+
* @param options Optional settings
|
|
1604
|
+
* @param callback The command result callback
|
|
1605
|
+
* @returns Promise if no callback is passed
|
|
1606
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#updateOne
|
|
1607
|
+
*/
|
|
1608
|
+
updateOne(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, callback: MongoCallback<UpdateWriteOpResult>): void;
|
|
1609
|
+
updateOne(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options?: UpdateOneOptions): Promise<UpdateWriteOpResult>;
|
|
1610
|
+
updateOne(filter: FilterQuery<TSchema>, update: UpdateQuery<TSchema> | Partial<TSchema>, options: UpdateOneOptions, callback: MongoCallback<UpdateWriteOpResult>): void;
|
|
1611
|
+
/**
|
|
1612
|
+
* Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.
|
|
1613
|
+
*
|
|
1614
|
+
* @param pipeline An array of {@link https://docs.mongodb.com/v3.6/reference/operator/aggregation-pipeline/ aggregation pipeline stages}
|
|
1615
|
+
* through which to pass change stream documents. This allows for filtering (using `$match`) and manipulating the change stream documents.
|
|
1616
|
+
* @param options Optional settings
|
|
1617
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#watch
|
|
1618
|
+
*/
|
|
1619
|
+
watch<T = TSchema>(pipeline?: object[], options?: ChangeStreamOptions & {
|
|
1620
|
+
session?: ClientSession | undefined;
|
|
1621
|
+
}): ChangeStream<T>;
|
|
1622
|
+
watch<T = TSchema>(options?: ChangeStreamOptions & {
|
|
1623
|
+
session?: ClientSession | undefined;
|
|
1624
|
+
}): ChangeStream<T>;
|
|
1625
|
+
}
|
|
1626
|
+
/** Update Query */
|
|
1627
|
+
declare type KeysOfAType<TSchema, Type> = {
|
|
1628
|
+
[key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? key : never;
|
|
1629
|
+
}[keyof TSchema];
|
|
1630
|
+
declare type KeysOfOtherType<TSchema, Type> = {
|
|
1631
|
+
[key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
|
|
1632
|
+
}[keyof TSchema];
|
|
1633
|
+
declare type AcceptedFields<TSchema, FieldType, AssignableType> = {
|
|
1634
|
+
readonly [key in KeysOfAType<TSchema, FieldType>]?: AssignableType;
|
|
1635
|
+
};
|
|
1636
|
+
/** It avoids using fields with not acceptable types */
|
|
1637
|
+
declare type NotAcceptedFields<TSchema, FieldType> = {
|
|
1638
|
+
readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
|
|
1639
|
+
};
|
|
1640
|
+
declare type DotAndArrayNotation<AssignableType> = {
|
|
1641
|
+
readonly [key: string]: AssignableType;
|
|
1642
|
+
};
|
|
1643
|
+
declare type ReadonlyPartial<TSchema> = {
|
|
1644
|
+
readonly [key in keyof TSchema]?: TSchema[key];
|
|
1645
|
+
};
|
|
1646
|
+
export declare type OnlyFieldsOfType<TSchema, FieldType = any, AssignableType = FieldType> = AcceptedFields<TSchema, FieldType, AssignableType> & NotAcceptedFields<TSchema, FieldType> & DotAndArrayNotation<AssignableType>;
|
|
1647
|
+
export declare type MatchKeysAndValues<TSchema> = ReadonlyPartial<TSchema> & DotAndArrayNotation<any>;
|
|
1648
|
+
declare type Unpacked<Type> = Type extends ReadonlyArray<infer Element> ? Element : Type;
|
|
1649
|
+
declare type UpdateOptionalId<T> = T extends {
|
|
1650
|
+
_id?: any;
|
|
1651
|
+
} ? OptionalId<T> : T;
|
|
1652
|
+
export declare type SortValues = -1 | 1;
|
|
1653
|
+
/**
|
|
1654
|
+
* Values for the $meta aggregation pipeline operator
|
|
1655
|
+
*
|
|
1656
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/aggregation/meta/#proj._S_meta
|
|
1657
|
+
*/
|
|
1658
|
+
export declare type MetaSortOperators = 'textScore' | 'indexKey';
|
|
1659
|
+
export declare type MetaProjectionOperators = MetaSortOperators
|
|
1660
|
+
/** Only for Atlas Search https://docs.atlas.mongodb.com/reference/atlas-search/scoring/ */
|
|
1661
|
+
| 'searchScore'
|
|
1662
|
+
/** Only for Atlas Search https://docs.atlas.mongodb.com/reference/atlas-search/highlighting/ */
|
|
1663
|
+
| 'searchHighlights';
|
|
1664
|
+
export declare type SchemaMember<T, V> = {
|
|
1665
|
+
[P in keyof T]?: V;
|
|
1666
|
+
} | {
|
|
1667
|
+
[key: string]: V;
|
|
1668
|
+
};
|
|
1669
|
+
export declare type SortOptionObject<T> = SchemaMember<T, number | {
|
|
1670
|
+
$meta?: MetaSortOperators | undefined;
|
|
1671
|
+
}>;
|
|
1672
|
+
export declare type AddToSetOperators<Type> = {
|
|
1673
|
+
$each: Type;
|
|
1674
|
+
};
|
|
1675
|
+
export declare type ArrayOperator<Type> = {
|
|
1676
|
+
$each: Type;
|
|
1677
|
+
$slice?: number | undefined;
|
|
1678
|
+
$position?: number | undefined;
|
|
1679
|
+
$sort?: SortValues | Record<string, SortValues> | undefined;
|
|
1680
|
+
};
|
|
1681
|
+
export declare type SetFields<TSchema> = ({
|
|
1682
|
+
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any> | undefined>]?: UpdateOptionalId<Unpacked<TSchema[key]>> | AddToSetOperators<Array<UpdateOptionalId<Unpacked<TSchema[key]>>>>;
|
|
1683
|
+
} & NotAcceptedFields<TSchema, ReadonlyArray<any> | undefined>) & {
|
|
1684
|
+
readonly [key: string]: AddToSetOperators<any> | any;
|
|
1685
|
+
};
|
|
1686
|
+
export declare type PushOperator<TSchema> = ({
|
|
1687
|
+
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: Unpacked<TSchema[key]> | ArrayOperator<Array<Unpacked<TSchema[key]>>>;
|
|
1688
|
+
} & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
|
|
1689
|
+
readonly [key: string]: ArrayOperator<any> | any;
|
|
1690
|
+
};
|
|
1691
|
+
export declare type PullOperator<TSchema> = ({
|
|
1692
|
+
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: Partial<Unpacked<TSchema[key]>> | ObjectQuerySelector<Unpacked<TSchema[key]>>;
|
|
1693
|
+
} & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
|
|
1694
|
+
readonly [key: string]: QuerySelector<any> | any;
|
|
1695
|
+
};
|
|
1696
|
+
export declare type PullAllOperator<TSchema> = ({
|
|
1697
|
+
readonly [key in KeysOfAType<TSchema, ReadonlyArray<any>>]?: TSchema[key];
|
|
1698
|
+
} & NotAcceptedFields<TSchema, ReadonlyArray<any>>) & {
|
|
1699
|
+
readonly [key: string]: any[];
|
|
1700
|
+
};
|
|
1701
|
+
/**
|
|
1702
|
+
* Modifiers to use in update operations
|
|
1703
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/update
|
|
1704
|
+
*
|
|
1705
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/update-field/
|
|
1706
|
+
* @param $currentDate Sets the value of a field to current date, either as a Date or a Timestamp.
|
|
1707
|
+
* @param $inc Increments the value of the field by the specified amount.
|
|
1708
|
+
* @param $min Only updates the field if the specified value is less than the existing field value.
|
|
1709
|
+
* @param $max Only updates the field if the specified value is greater than the existing field value.
|
|
1710
|
+
* @param $mul Multiplies the value of the field by the specified amount.
|
|
1711
|
+
* @param $rename Renames a field.
|
|
1712
|
+
* @param $set Sets the value of a field in a document.
|
|
1713
|
+
* @param $setOnInsert Sets the value of a field if an update results in an insert of a document. Has no effect on update operations that modify existing documents.
|
|
1714
|
+
* @param $unset Removes the specified field from a document.
|
|
1715
|
+
*
|
|
1716
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/update-array/
|
|
1717
|
+
* @param $addToSet Adds elements to an array only if they do not already exist in the set.
|
|
1718
|
+
* @param $pop Removes the first or last item of an array.
|
|
1719
|
+
* @param $pull Removes all array elements that match a specified query.
|
|
1720
|
+
* @param $push Adds an item to an array.
|
|
1721
|
+
* @param $pullAll Removes all matching values from an array.
|
|
1722
|
+
* @param $bit Performs bitwise `AND`, `OR`, and `XOR` updates of integer values.
|
|
1723
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/update-bitwise/
|
|
1724
|
+
*
|
|
1725
|
+
*/
|
|
1726
|
+
export declare type UpdateQuery<TSchema> = {
|
|
1727
|
+
$currentDate?: OnlyFieldsOfType<TSchema, Date | Timestamp, true | {
|
|
1728
|
+
$type: 'date' | 'timestamp';
|
|
1729
|
+
}> | undefined;
|
|
1730
|
+
$inc?: OnlyFieldsOfType<TSchema, NumericTypes | undefined> | undefined;
|
|
1731
|
+
$min?: MatchKeysAndValues<TSchema> | undefined;
|
|
1732
|
+
$max?: MatchKeysAndValues<TSchema> | undefined;
|
|
1733
|
+
$mul?: OnlyFieldsOfType<TSchema, NumericTypes | undefined> | undefined;
|
|
1734
|
+
$rename?: {
|
|
1735
|
+
[key: string]: string;
|
|
1736
|
+
} | undefined;
|
|
1737
|
+
$set?: MatchKeysAndValues<TSchema> | undefined;
|
|
1738
|
+
$setOnInsert?: MatchKeysAndValues<TSchema> | undefined;
|
|
1739
|
+
$unset?: OnlyFieldsOfType<TSchema, any, '' | 1 | true> | undefined;
|
|
1740
|
+
$addToSet?: SetFields<TSchema> | undefined;
|
|
1741
|
+
$pop?: OnlyFieldsOfType<TSchema, ReadonlyArray<any>, 1 | -1> | undefined;
|
|
1742
|
+
$pull?: PullOperator<TSchema> | undefined;
|
|
1743
|
+
$push?: PushOperator<TSchema> | undefined;
|
|
1744
|
+
$pullAll?: PullAllOperator<TSchema> | undefined;
|
|
1745
|
+
$bit?: {
|
|
1746
|
+
[key: string]: {
|
|
1747
|
+
[key in 'and' | 'or' | 'xor']?: number;
|
|
1748
|
+
};
|
|
1749
|
+
} | undefined;
|
|
1750
|
+
};
|
|
1751
|
+
/**
|
|
1752
|
+
* Available BSON types
|
|
1753
|
+
*
|
|
1754
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/query/type/#available-types
|
|
1755
|
+
*/
|
|
1756
|
+
export declare enum BsonType {
|
|
1757
|
+
Double = 1,
|
|
1758
|
+
String = 2,
|
|
1759
|
+
Object = 3,
|
|
1760
|
+
Array = 4,
|
|
1761
|
+
BinData = 5,
|
|
1762
|
+
/** @deprecated */
|
|
1763
|
+
Undefined = 6,
|
|
1764
|
+
ObjectId = 7,
|
|
1765
|
+
Boolean = 8,
|
|
1766
|
+
Date = 9,
|
|
1767
|
+
Null = 10,
|
|
1768
|
+
Regex = 11,
|
|
1769
|
+
/** @deprecated */
|
|
1770
|
+
DbPointer = 12,
|
|
1771
|
+
JavaScript = 13,
|
|
1772
|
+
/** @deprecated */
|
|
1773
|
+
Symbol = 14,
|
|
1774
|
+
JavaScriptWithScope = 15,
|
|
1775
|
+
Int = 16,
|
|
1776
|
+
Timestamp = 17,
|
|
1777
|
+
Long = 18,
|
|
1778
|
+
Decimal = 19,
|
|
1779
|
+
MinKey = -1,
|
|
1780
|
+
MaxKey = 127
|
|
1781
|
+
}
|
|
1782
|
+
declare type BSONTypeAlias = 'number' | 'double' | 'string' | 'object' | 'array' | 'binData' | 'undefined' | 'objectId' | 'bool' | 'date' | 'null' | 'regex' | 'dbPointer' | 'javascript' | 'symbol' | 'javascriptWithScope' | 'int' | 'timestamp' | 'long' | 'decimal' | 'minKey' | 'maxKey';
|
|
1783
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query-bitwise */
|
|
1784
|
+
declare type BitwiseQuery = number /** <numeric bitmask> */ | Binary /** <BinData bitmask> */ | number[]; /** [ <position1>, <position2>, ... ] */
|
|
1785
|
+
declare type RegExpForString<T> = T extends string ? RegExp | T : T;
|
|
1786
|
+
declare type MongoAltQuery<T> = T extends ReadonlyArray<infer U> ? T | RegExpForString<U> : RegExpForString<T>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Available query selector types
|
|
1789
|
+
*
|
|
1790
|
+
* @param $eq Matches values that are equal to a specified value.
|
|
1791
|
+
* @param $gt Matches values that are greater than a specified value.
|
|
1792
|
+
* @param $gte Matches values that are greater than or equal to a specified value.
|
|
1793
|
+
* @param $in Matches values that are greater than or equal to a specified value.
|
|
1794
|
+
* @param $lt Matches values that are less than a specified value.
|
|
1795
|
+
* @param $lte Matches values that are less than or equal to a specified value.
|
|
1796
|
+
* @param $ne Matches all values that are not equal to a specified value.
|
|
1797
|
+
* @param $nin Matches none of the values specified in an array.
|
|
1798
|
+
*
|
|
1799
|
+
* @param $and Joins query clauses with a logical `AND` returns all documents that match the conditions of both clauses.
|
|
1800
|
+
* @param $not Inverts the effect of a query expression and returns documents that do not match the query expression.
|
|
1801
|
+
* @param $nor Joins query clauses with a logical `NOR` returns all documents that fail to match both clauses.
|
|
1802
|
+
* @param $or Joins query clauses with a logical `OR` returns all documents that match the conditions of either clause.
|
|
1803
|
+
*
|
|
1804
|
+
* @param $exists Matches documents that have the specified field.
|
|
1805
|
+
* @param $type Selects documents if a field is of the specified type.
|
|
1806
|
+
*
|
|
1807
|
+
* @param $expr Allows use of aggregation expressions within the query language.
|
|
1808
|
+
* @param $jsonSchema Validate documents against the given JSON Schema.
|
|
1809
|
+
* @param $mod Performs a modulo operation on the value of a field and selects documents with a specified result.
|
|
1810
|
+
* @param $regex Selects documents where values match a specified regular expression.
|
|
1811
|
+
* @param $text Performs text search.
|
|
1812
|
+
* @param $where Matches documents that satisfy a JavaScript expression.
|
|
1813
|
+
*
|
|
1814
|
+
* @param $geoIntersects Selects geometries that intersect with a {@link https://docs.mongodb.com/v3.6/reference/glossary/#term-geojson GeoJSON} geometry.
|
|
1815
|
+
* The {@link https://docs.mongodb.com/v3.6/core/2dsphere/ 2dsphere} index supports {@link https://docs.mongodb.com/v3.6/reference/operator/query/geoIntersects/#op._S_geoIntersects $geoIntersects}.
|
|
1816
|
+
* @param $geoWithin Selects geometries within a bounding {@link https://docs.mongodb.com/v3.6/reference/geojson/#geospatial-indexes-store-geojson GeoJSON geometry}.
|
|
1817
|
+
* The {@link https://docs.mongodb.com/v3.6/core/2dsphere/ 2dsphere} and {@link https://docs.mongodb.com/v3.6/core/2d/ 2d} indexes
|
|
1818
|
+
* support {@link https://docs.mongodb.com/v3.6/reference/operator/query/geoWithin/#op._S_geoWithin $geoWithin}.
|
|
1819
|
+
* @param $near Returns geospatial objects in proximity to a point. Requires a geospatial index. The {@link https://docs.mongodb.com/v3.6/core/2dsphere/ 2dsphere}
|
|
1820
|
+
* and {@link https://docs.mongodb.com/v3.6/core/2d/ 2d} indexes support {@link https://docs.mongodb.com/v3.6/reference/operator/query/near/#op._S_near $near}.
|
|
1821
|
+
* @param $nearSphere Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The {@link https://docs.mongodb.com/v3.6/core/2dsphere/ 2dsphere} and
|
|
1822
|
+
* {@link https://docs.mongodb.com/v3.6/reference/operator/query/nearSphere/#op._S_nearSphere 2d} indexes support
|
|
1823
|
+
* {@link https://docs.mongodb.com/v3.6/reference/operator/query/nearSphere/#op._S_nearSphere $nearSphere}.
|
|
1824
|
+
*
|
|
1825
|
+
* @param $all Matches arrays that contain all elements specified in the query.
|
|
1826
|
+
* @param $elemMatch Selects documents if element in the array field matches all the specified
|
|
1827
|
+
* {@link https://docs.mongodb.com/v3.6/reference/operator/query/elemMatch/#op._S_elemMatch $elemMatch} conditions.
|
|
1828
|
+
* @param $size Selects documents if the array field is a specified size.
|
|
1829
|
+
*
|
|
1830
|
+
* @param $bitsAllClear Matches numeric or binary values in which a set of bit positions all have a value of `0`.
|
|
1831
|
+
* @param $bitsAllSet Matches numeric or binary values in which a set of bit positions all have a value of `1`.
|
|
1832
|
+
* @param $bitsAnyClear Matches numeric or binary values in which any bit from a set of bit positions has a value of `0`.
|
|
1833
|
+
* @param $bitsAnySet Matches numeric or binary values in which any bit from a set of bit positions has a value of `1`.
|
|
1834
|
+
*
|
|
1835
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/query/#query-selectors
|
|
1836
|
+
*/
|
|
1837
|
+
export declare type QuerySelector<T> = {
|
|
1838
|
+
$eq?: T | undefined;
|
|
1839
|
+
$gt?: T | undefined;
|
|
1840
|
+
$gte?: T | undefined;
|
|
1841
|
+
$in?: T[] | undefined;
|
|
1842
|
+
$lt?: T | undefined;
|
|
1843
|
+
$lte?: T | undefined;
|
|
1844
|
+
$ne?: T | undefined;
|
|
1845
|
+
$nin?: T[] | undefined;
|
|
1846
|
+
$not?: T extends string ? QuerySelector<T> | RegExp : QuerySelector<T> | undefined;
|
|
1847
|
+
/**
|
|
1848
|
+
* When `true`, `$exists` matches the documents that contain the field,
|
|
1849
|
+
* including documents where the field value is null.
|
|
1850
|
+
*/
|
|
1851
|
+
$exists?: boolean | undefined;
|
|
1852
|
+
$type?: BSONType | BSONTypeAlias | undefined;
|
|
1853
|
+
$expr?: any;
|
|
1854
|
+
$jsonSchema?: any;
|
|
1855
|
+
$mod?: T extends number ? [number, number] : never | undefined;
|
|
1856
|
+
$regex?: T extends string ? RegExp | string : never | undefined;
|
|
1857
|
+
$options?: T extends string ? string : never | undefined;
|
|
1858
|
+
$geoIntersects?: {
|
|
1859
|
+
$geometry: object;
|
|
1860
|
+
} | undefined;
|
|
1861
|
+
$geoWithin?: object | undefined;
|
|
1862
|
+
$near?: object | undefined;
|
|
1863
|
+
$nearSphere?: object | undefined;
|
|
1864
|
+
$maxDistance?: number | undefined;
|
|
1865
|
+
$all?: T extends ReadonlyArray<infer U> ? U[] : never | undefined;
|
|
1866
|
+
$elemMatch?: T extends ReadonlyArray<infer U> ? U : never | undefined;
|
|
1867
|
+
$size?: T extends ReadonlyArray<infer U> ? U : never | undefined;
|
|
1868
|
+
$bitsAllClear?: BitwiseQuery | undefined;
|
|
1869
|
+
$bitsAllSet?: BitwiseQuery | undefined;
|
|
1870
|
+
$bitsAnyClear?: BitwiseQuery | undefined;
|
|
1871
|
+
$bitsAnySet?: BitwiseQuery | undefined;
|
|
1872
|
+
};
|
|
1873
|
+
export declare type RootQuerySelector<T> = {
|
|
1874
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/and/#op._S_and */
|
|
1875
|
+
$and?: Array<FilterQuery<T>> | undefined;
|
|
1876
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/nor/#op._S_nor */
|
|
1877
|
+
$nor?: Array<FilterQuery<T>> | undefined;
|
|
1878
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/or/#op._S_or */
|
|
1879
|
+
$or?: Array<FilterQuery<T>> | undefined;
|
|
1880
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/text */
|
|
1881
|
+
$text?: {
|
|
1882
|
+
$search: string;
|
|
1883
|
+
$language?: string | undefined;
|
|
1884
|
+
$caseSensitive?: boolean | undefined;
|
|
1885
|
+
$diacriticSensitive?: boolean | undefined;
|
|
1886
|
+
} | undefined;
|
|
1887
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/where/#op._S_where */
|
|
1888
|
+
$where?: string | Function | undefined;
|
|
1889
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/query/comment/#op._S_comment */
|
|
1890
|
+
$comment?: string | undefined;
|
|
1891
|
+
[key: string]: any;
|
|
1892
|
+
};
|
|
1893
|
+
export declare type ObjectQuerySelector<T> = T extends object ? {
|
|
1894
|
+
[key in keyof T]?: QuerySelector<T[key]>;
|
|
1895
|
+
} : QuerySelector<T>;
|
|
1896
|
+
export declare type Condition<T> = MongoAltQuery<T> | QuerySelector<MongoAltQuery<T>>;
|
|
1897
|
+
export declare type FilterQuery<T> = {
|
|
1898
|
+
[P in keyof T]?: Condition<T[P]>;
|
|
1899
|
+
} & RootQuerySelector<T>;
|
|
1900
|
+
/** @see https://docs.mongodb.com/v3.6/reference/method/db.collection.bulkWrite/#insertone */
|
|
1901
|
+
export declare type BulkWriteInsertOneOperation<TSchema> = {
|
|
1902
|
+
insertOne: {
|
|
1903
|
+
document: OptionalId<TSchema>;
|
|
1904
|
+
};
|
|
1905
|
+
};
|
|
1906
|
+
/**
|
|
1907
|
+
* Options for the updateOne and updateMany operations
|
|
1908
|
+
*
|
|
1909
|
+
* @param arrayFilters Optional. An array of filter documents that determines which array elements to modify for an update operation on an array field.
|
|
1910
|
+
* @param collaction Optional. Specifies the collation to use for the operation.
|
|
1911
|
+
* @param filter The selection criteria for the update. The same {@link https://docs.mongodb.com/v3.6/reference/operator/query/#query-selectors query selectors}
|
|
1912
|
+
* as in the {@link https://docs.mongodb.com/v3.6/reference/method/db.collection.find/#db.collection.find find()} method are available.
|
|
1913
|
+
* @param update The modifications to apply.
|
|
1914
|
+
* @param upsert When true, the operation either creates a new document if no documents match the `filter` or updates the document(s) that match the `filter`.
|
|
1915
|
+
* For more details see {@link https://docs.mongodb.com/v3.6/reference/method/db.collection.update/#upsert-behavior upsert behavior}
|
|
1916
|
+
* @see https://docs.mongodb.com/v3.6/reference/method/db.collection.bulkWrite/#updateone-and-updatemany
|
|
1917
|
+
*/
|
|
1918
|
+
export declare type BulkWriteUpdateOperation<TSchema> = {
|
|
1919
|
+
arrayFilters?: object[] | undefined;
|
|
1920
|
+
collation?: object | undefined;
|
|
1921
|
+
filter: FilterQuery<TSchema>;
|
|
1922
|
+
update: UpdateQuery<TSchema>;
|
|
1923
|
+
upsert?: boolean | undefined;
|
|
1924
|
+
};
|
|
1925
|
+
export declare type BulkWriteUpdateOneOperation<TSchema> = {
|
|
1926
|
+
updateOne: BulkWriteUpdateOperation<TSchema>;
|
|
1927
|
+
};
|
|
1928
|
+
export declare type BulkWriteUpdateManyOperation<TSchema> = {
|
|
1929
|
+
updateMany: BulkWriteUpdateOperation<TSchema>;
|
|
1930
|
+
};
|
|
1931
|
+
/**
|
|
1932
|
+
* Options for the replaceOne operation
|
|
1933
|
+
*
|
|
1934
|
+
* @param collation Optional. Specifies the {@link https://docs.mongodb.com/v3.6/reference/bson-type-comparison-order/#collation collation} to use for the operation.
|
|
1935
|
+
* @param filter The selection criteria for the update. The same {@link https://docs.mongodb.com/v3.6/reference/operator/query/#query-selectors query selectors}
|
|
1936
|
+
* as in the {@link https://docs.mongodb.com/v3.6/reference/method/db.collection.find/#db.collection.find find()} method are available.
|
|
1937
|
+
* @param replacement The replacement document.
|
|
1938
|
+
* @param upsert When true, replaceOne either inserts the document from the `replacement` parameter if no document matches the `filter`
|
|
1939
|
+
* or replaces the document that matches the `filter` with the `replacement` document.
|
|
1940
|
+
* For more details see {@link https://docs.mongodb.com/v3.6/reference/method/db.collection.update/#upsert-behavior upsert behavior}
|
|
1941
|
+
* @see https://docs.mongodb.com/v3.6/reference/method/db.collection.bulkWrite/#replaceone
|
|
1942
|
+
*/
|
|
1943
|
+
export declare type BulkWriteReplaceOneOperation<TSchema> = {
|
|
1944
|
+
replaceOne: {
|
|
1945
|
+
collation?: object | undefined;
|
|
1946
|
+
filter: FilterQuery<TSchema>;
|
|
1947
|
+
replacement: TSchema;
|
|
1948
|
+
upsert?: boolean | undefined;
|
|
1949
|
+
};
|
|
1950
|
+
};
|
|
1951
|
+
/**
|
|
1952
|
+
* Options for the deleteOne and deleteMany operations
|
|
1953
|
+
*
|
|
1954
|
+
* @param collation Optional. Specifies the collation to use for the operation.
|
|
1955
|
+
* @param filter Specifies deletion criteria using {@link https://docs.mongodb.com/v3.6/reference/operator/ query operators}.
|
|
1956
|
+
* @see https://docs.mongodb.com/v3.6/reference/method/db.collection.bulkWrite/#deleteone-and-deletemany
|
|
1957
|
+
*/
|
|
1958
|
+
export declare type BulkWriteDeleteOperation<TSchema> = {
|
|
1959
|
+
collation?: object | undefined;
|
|
1960
|
+
filter: FilterQuery<TSchema>;
|
|
1961
|
+
};
|
|
1962
|
+
export declare type BulkWriteDeleteOneOperation<TSchema> = {
|
|
1963
|
+
deleteOne: BulkWriteDeleteOperation<TSchema>;
|
|
1964
|
+
};
|
|
1965
|
+
export declare type BulkWriteDeleteManyOperation<TSchema> = {
|
|
1966
|
+
deleteMany: BulkWriteDeleteOperation<TSchema>;
|
|
1967
|
+
};
|
|
1968
|
+
/**
|
|
1969
|
+
* Possible operations with the Collection.bulkWrite method
|
|
1970
|
+
*
|
|
1971
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#bulkWrite
|
|
1972
|
+
*/
|
|
1973
|
+
export declare type BulkWriteOperation<TSchema> = BulkWriteInsertOneOperation<TSchema> | BulkWriteUpdateOneOperation<TSchema> | BulkWriteUpdateManyOperation<TSchema> | BulkWriteReplaceOneOperation<TSchema> | BulkWriteDeleteOneOperation<TSchema> | BulkWriteDeleteManyOperation<TSchema>;
|
|
1974
|
+
/**
|
|
1975
|
+
* Returned object for the CollStats command in db.runCommand
|
|
1976
|
+
*
|
|
1977
|
+
* @see https://docs.mongodb.org/manual/reference/command/collStats/
|
|
1978
|
+
*/
|
|
1979
|
+
export interface CollStats {
|
|
1980
|
+
/**
|
|
1981
|
+
* Namespace.
|
|
1982
|
+
*/
|
|
1983
|
+
ns: string;
|
|
1984
|
+
/**
|
|
1985
|
+
* Number of documents.
|
|
1986
|
+
*/
|
|
1987
|
+
count: number;
|
|
1988
|
+
/**
|
|
1989
|
+
* Collection size in bytes.
|
|
1990
|
+
*/
|
|
1991
|
+
size: number;
|
|
1992
|
+
/**
|
|
1993
|
+
* Average object size in bytes.
|
|
1994
|
+
*/
|
|
1995
|
+
avgObjSize: number;
|
|
1996
|
+
/**
|
|
1997
|
+
* (Pre)allocated space for the collection in bytes.
|
|
1998
|
+
*/
|
|
1999
|
+
storageSize: number;
|
|
2000
|
+
/**
|
|
2001
|
+
* Number of extents (contiguously allocated chunks of datafile space).
|
|
2002
|
+
*/
|
|
2003
|
+
numExtents: number;
|
|
2004
|
+
/**
|
|
2005
|
+
* Number of indexes.
|
|
2006
|
+
*/
|
|
2007
|
+
nindexes: number;
|
|
2008
|
+
/**
|
|
2009
|
+
* Size of the most recently created extent in bytes.
|
|
2010
|
+
*/
|
|
2011
|
+
lastExtentSize: number;
|
|
2012
|
+
/**
|
|
2013
|
+
* Padding can speed up updates if documents grow.
|
|
2014
|
+
*/
|
|
2015
|
+
paddingFactor: number;
|
|
2016
|
+
/**
|
|
2017
|
+
* A number that indicates the user-set flags on the collection. userFlags only appears when using the mmapv1 storage engine.
|
|
2018
|
+
*/
|
|
2019
|
+
userFlags?: number | undefined;
|
|
2020
|
+
/**
|
|
2021
|
+
* Total index size in bytes.
|
|
2022
|
+
*/
|
|
2023
|
+
totalIndexSize: number;
|
|
2024
|
+
/**
|
|
2025
|
+
* Size of specific indexes in bytes.
|
|
2026
|
+
*/
|
|
2027
|
+
indexSizes: {
|
|
2028
|
+
_id_: number;
|
|
2029
|
+
[index: string]: number;
|
|
2030
|
+
};
|
|
2031
|
+
/**
|
|
2032
|
+
* `true` if the collection is capped.
|
|
2033
|
+
*/
|
|
2034
|
+
capped: boolean;
|
|
2035
|
+
/**
|
|
2036
|
+
* The maximum number of documents that may be present in a capped collection.
|
|
2037
|
+
*/
|
|
2038
|
+
max: number;
|
|
2039
|
+
/**
|
|
2040
|
+
* The maximum size of a capped collection.
|
|
2041
|
+
*/
|
|
2042
|
+
maxSize: number;
|
|
2043
|
+
wiredTiger?: WiredTigerData | undefined;
|
|
2044
|
+
indexDetails?: any;
|
|
2045
|
+
ok: number;
|
|
2046
|
+
}
|
|
2047
|
+
export interface WiredTigerData {
|
|
2048
|
+
LSM: {
|
|
2049
|
+
'bloom filter false positives': number;
|
|
2050
|
+
'bloom filter hits': number;
|
|
2051
|
+
'bloom filter misses': number;
|
|
2052
|
+
'bloom filter pages evicted from cache': number;
|
|
2053
|
+
'bloom filter pages read into cache': number;
|
|
2054
|
+
'bloom filters in the LSM tree': number;
|
|
2055
|
+
'chunks in the LSM tree': number;
|
|
2056
|
+
'highest merge generation in the LSM tree': number;
|
|
2057
|
+
'queries that could have benefited from a Bloom filter that did not exist': number;
|
|
2058
|
+
'sleep for LSM checkpoint throttle': number;
|
|
2059
|
+
'sleep for LSM merge throttle': number;
|
|
2060
|
+
'total size of bloom filters': number;
|
|
2061
|
+
};
|
|
2062
|
+
'block-manager': {
|
|
2063
|
+
'allocations requiring file extension': number;
|
|
2064
|
+
'blocks allocated': number;
|
|
2065
|
+
'blocks freed': number;
|
|
2066
|
+
'checkpoint size': number;
|
|
2067
|
+
'file allocation unit size': number;
|
|
2068
|
+
'file bytes available for reuse': number;
|
|
2069
|
+
'file magic number': number;
|
|
2070
|
+
'file major version number': number;
|
|
2071
|
+
'file size in bytes': number;
|
|
2072
|
+
'minor version number': number;
|
|
2073
|
+
};
|
|
2074
|
+
btree: {
|
|
2075
|
+
'btree checkpoint generation': number;
|
|
2076
|
+
'column-store fixed-size leaf pages': number;
|
|
2077
|
+
'column-store internal pages': number;
|
|
2078
|
+
'column-store variable-size RLE encoded values': number;
|
|
2079
|
+
'column-store variable-size deleted values': number;
|
|
2080
|
+
'column-store variable-size leaf pages': number;
|
|
2081
|
+
'fixed-record size': number;
|
|
2082
|
+
'maximum internal page key size': number;
|
|
2083
|
+
'maximum internal page size': number;
|
|
2084
|
+
'maximum leaf page key size': number;
|
|
2085
|
+
'maximum leaf page size': number;
|
|
2086
|
+
'maximum leaf page value size': number;
|
|
2087
|
+
'maximum tree depth': number;
|
|
2088
|
+
'number of key/value pairs': number;
|
|
2089
|
+
'overflow pages': number;
|
|
2090
|
+
'pages rewritten by compaction': number;
|
|
2091
|
+
'row-store internal pages': number;
|
|
2092
|
+
'row-store leaf pages': number;
|
|
2093
|
+
};
|
|
2094
|
+
cache: {
|
|
2095
|
+
'bytes currently in the cache': number;
|
|
2096
|
+
'bytes read into cache': number;
|
|
2097
|
+
'bytes written from cache': number;
|
|
2098
|
+
'checkpoint blocked page eviction': number;
|
|
2099
|
+
'data source pages selected for eviction unable to be evicted': number;
|
|
2100
|
+
'hazard pointer blocked page eviction': number;
|
|
2101
|
+
'in-memory page passed criteria to be split': number;
|
|
2102
|
+
'in-memory page splits': number;
|
|
2103
|
+
'internal pages evicted': number;
|
|
2104
|
+
'internal pages split during eviction': number;
|
|
2105
|
+
'leaf pages split during eviction': number;
|
|
2106
|
+
'modified pages evicted': number;
|
|
2107
|
+
'overflow pages read into cache': number;
|
|
2108
|
+
'overflow values cached in memory': number;
|
|
2109
|
+
'page split during eviction deepened the tree': number;
|
|
2110
|
+
'page written requiring lookaside records': number;
|
|
2111
|
+
'pages read into cache': number;
|
|
2112
|
+
'pages read into cache requiring lookaside entries': number;
|
|
2113
|
+
'pages requested from the cache': number;
|
|
2114
|
+
'pages written from cache': number;
|
|
2115
|
+
'pages written requiring in-memory restoration': number;
|
|
2116
|
+
'tracked dirty bytes in the cache': number;
|
|
2117
|
+
'unmodified pages evicted': number;
|
|
2118
|
+
};
|
|
2119
|
+
cache_walk: {
|
|
2120
|
+
'Average difference between current eviction generation when the page was last considered': number;
|
|
2121
|
+
'Average on-disk page image size seen': number;
|
|
2122
|
+
'Clean pages currently in cache': number;
|
|
2123
|
+
'Current eviction generation': number;
|
|
2124
|
+
'Dirty pages currently in cache': number;
|
|
2125
|
+
'Entries in the root page': number;
|
|
2126
|
+
'Internal pages currently in cache': number;
|
|
2127
|
+
'Leaf pages currently in cache': number;
|
|
2128
|
+
'Maximum difference between current eviction generation when the page was last considered': number;
|
|
2129
|
+
'Maximum page size seen': number;
|
|
2130
|
+
'Minimum on-disk page image size seen': number;
|
|
2131
|
+
'On-disk page image sizes smaller than a single allocation unit': number;
|
|
2132
|
+
'Pages created in memory and never written': number;
|
|
2133
|
+
'Pages currently queued for eviction': number;
|
|
2134
|
+
'Pages that could not be queued for eviction': number;
|
|
2135
|
+
'Refs skipped during cache traversal': number;
|
|
2136
|
+
'Size of the root page': number;
|
|
2137
|
+
'Total number of pages currently in cache': number;
|
|
2138
|
+
};
|
|
2139
|
+
compression: {
|
|
2140
|
+
'compressed pages read': number;
|
|
2141
|
+
'compressed pages written': number;
|
|
2142
|
+
'page written failed to compress': number;
|
|
2143
|
+
'page written was too small to compress': number;
|
|
2144
|
+
'raw compression call failed, additional data available': number;
|
|
2145
|
+
'raw compression call failed, no additional data available': number;
|
|
2146
|
+
'raw compression call succeeded': number;
|
|
2147
|
+
};
|
|
2148
|
+
cursor: {
|
|
2149
|
+
'bulk-loaded cursor-insert calls': number;
|
|
2150
|
+
'create calls': number;
|
|
2151
|
+
'cursor-insert key and value bytes inserted': number;
|
|
2152
|
+
'cursor-remove key bytes removed': number;
|
|
2153
|
+
'cursor-update value bytes updated': number;
|
|
2154
|
+
'insert calls': number;
|
|
2155
|
+
'next calls': number;
|
|
2156
|
+
'prev calls': number;
|
|
2157
|
+
'remove calls': number;
|
|
2158
|
+
'reset calls': number;
|
|
2159
|
+
'restarted searches': number;
|
|
2160
|
+
'search calls': number;
|
|
2161
|
+
'search near calls': number;
|
|
2162
|
+
'truncate calls': number;
|
|
2163
|
+
'update calls': number;
|
|
2164
|
+
};
|
|
2165
|
+
reconciliation: {
|
|
2166
|
+
'dictionary matches': number;
|
|
2167
|
+
'fast-path pages deleted': number;
|
|
2168
|
+
'internal page key bytes discarded using suffix compression': number;
|
|
2169
|
+
'internal page multi-block writes': number;
|
|
2170
|
+
'internal-page overflow keys': number;
|
|
2171
|
+
'leaf page key bytes discarded using prefix compression': number;
|
|
2172
|
+
'leaf page multi-block writes': number;
|
|
2173
|
+
'leaf-page overflow keys': number;
|
|
2174
|
+
'maximum blocks required for a page': number;
|
|
2175
|
+
'overflow values written': number;
|
|
2176
|
+
'page checksum matches': number;
|
|
2177
|
+
'page reconciliation calls': number;
|
|
2178
|
+
'page reconciliation calls for eviction': number;
|
|
2179
|
+
'pages deleted': number;
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Options for Collection.aggregate
|
|
2184
|
+
*
|
|
2185
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#aggregate
|
|
2186
|
+
*/
|
|
2187
|
+
export interface CollectionAggregationOptions {
|
|
2188
|
+
/**
|
|
2189
|
+
* The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
2190
|
+
*/
|
|
2191
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2192
|
+
/**
|
|
2193
|
+
* Return the query as cursor, on 2.6 > it returns as a real cursor
|
|
2194
|
+
* on pre 2.6 it returns as an emulated cursor.
|
|
2195
|
+
*/
|
|
2196
|
+
cursor?: {
|
|
2197
|
+
batchSize?: number | undefined;
|
|
2198
|
+
} | undefined;
|
|
2199
|
+
/**
|
|
2200
|
+
* Explain returns the aggregation execution plan (requires mongodb 2.6 >).
|
|
2201
|
+
*/
|
|
2202
|
+
explain?: boolean | undefined;
|
|
2203
|
+
/**
|
|
2204
|
+
* Lets the server know if it can use disk to store
|
|
2205
|
+
* temporary results for the aggregation (requires mongodb 2.6 >).
|
|
2206
|
+
*/
|
|
2207
|
+
allowDiskUse?: boolean | undefined;
|
|
2208
|
+
/**
|
|
2209
|
+
* Specifies a cumulative time limit in milliseconds for processing operations
|
|
2210
|
+
* on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.
|
|
2211
|
+
*/
|
|
2212
|
+
maxTimeMS?: number | undefined;
|
|
2213
|
+
/**
|
|
2214
|
+
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
2215
|
+
*/
|
|
2216
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2217
|
+
hint?: string | object | undefined;
|
|
2218
|
+
raw?: boolean | undefined;
|
|
2219
|
+
promoteLongs?: boolean | undefined;
|
|
2220
|
+
promoteValues?: boolean | undefined;
|
|
2221
|
+
promoteBuffers?: boolean | undefined;
|
|
2222
|
+
collation?: CollationDocument | undefined;
|
|
2223
|
+
comment?: string | undefined;
|
|
2224
|
+
session?: ClientSession | undefined;
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Options for Collection.insertMany
|
|
2228
|
+
*
|
|
2229
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#insertMany
|
|
2230
|
+
*/
|
|
2231
|
+
export interface CollectionInsertManyOptions extends CommonOptions {
|
|
2232
|
+
/**
|
|
2233
|
+
* Serialize functions on any object.
|
|
2234
|
+
*/
|
|
2235
|
+
serializeFunctions?: boolean | undefined;
|
|
2236
|
+
/**
|
|
2237
|
+
* Force server to assign _id values instead of driver.
|
|
2238
|
+
*/
|
|
2239
|
+
forceServerObjectId?: boolean | undefined;
|
|
2240
|
+
/**
|
|
2241
|
+
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
2242
|
+
*/
|
|
2243
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2244
|
+
/**
|
|
2245
|
+
* If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
|
|
2246
|
+
*/
|
|
2247
|
+
ordered?: boolean | undefined;
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Options for Collection.bulkWrite
|
|
2251
|
+
*
|
|
2252
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#bulkWrite
|
|
2253
|
+
*/
|
|
2254
|
+
export interface CollectionBulkWriteOptions extends CommonOptions {
|
|
2255
|
+
/**
|
|
2256
|
+
* Serialize functions on any object.
|
|
2257
|
+
*/
|
|
2258
|
+
serializeFunctions?: boolean | undefined;
|
|
2259
|
+
/**
|
|
2260
|
+
* Execute write operation in ordered or unordered fashion.
|
|
2261
|
+
*/
|
|
2262
|
+
ordered?: boolean | undefined;
|
|
2263
|
+
/**
|
|
2264
|
+
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
2265
|
+
*/
|
|
2266
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2267
|
+
forceServerObjectId?: boolean | undefined;
|
|
2268
|
+
}
|
|
2269
|
+
/**
|
|
2270
|
+
* Returning object for Collection.bulkWrite operations
|
|
2271
|
+
*
|
|
2272
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~BulkWriteOpResult
|
|
2273
|
+
*/
|
|
2274
|
+
export interface BulkWriteOpResultObject {
|
|
2275
|
+
insertedCount?: number | undefined;
|
|
2276
|
+
matchedCount?: number | undefined;
|
|
2277
|
+
modifiedCount?: number | undefined;
|
|
2278
|
+
deletedCount?: number | undefined;
|
|
2279
|
+
upsertedCount?: number | undefined;
|
|
2280
|
+
insertedIds?: {
|
|
2281
|
+
[index: number]: any;
|
|
2282
|
+
} | undefined;
|
|
2283
|
+
upsertedIds?: {
|
|
2284
|
+
[index: number]: any;
|
|
2285
|
+
} | undefined;
|
|
2286
|
+
result?: any;
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Options for Collection.count
|
|
2290
|
+
*
|
|
2291
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#count
|
|
2292
|
+
*/
|
|
2293
|
+
export interface MongoCountPreferences {
|
|
2294
|
+
/**
|
|
2295
|
+
* The limit of documents to count.
|
|
2296
|
+
*/
|
|
2297
|
+
limit?: number | undefined;
|
|
2298
|
+
/**
|
|
2299
|
+
* The number of documents to skip for the count.
|
|
2300
|
+
*/
|
|
2301
|
+
skip?: number | undefined;
|
|
2302
|
+
/**
|
|
2303
|
+
* An index name hint for the query.
|
|
2304
|
+
*/
|
|
2305
|
+
hint?: string | undefined;
|
|
2306
|
+
/**
|
|
2307
|
+
* The preferred read preference
|
|
2308
|
+
*/
|
|
2309
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2310
|
+
/**
|
|
2311
|
+
* Number of miliseconds to wait before aborting the query.
|
|
2312
|
+
*/
|
|
2313
|
+
maxTimeMS?: number | undefined;
|
|
2314
|
+
/**
|
|
2315
|
+
* Optional session to use for this operation
|
|
2316
|
+
*/
|
|
2317
|
+
session?: ClientSession | undefined;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Options for Collection.distinct
|
|
2321
|
+
*
|
|
2322
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#distinct
|
|
2323
|
+
*/
|
|
2324
|
+
export interface MongoDistinctPreferences {
|
|
2325
|
+
/**
|
|
2326
|
+
* The preferred read preference
|
|
2327
|
+
*/
|
|
2328
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2329
|
+
/**
|
|
2330
|
+
* Number of miliseconds to wait before aborting the query.
|
|
2331
|
+
*/
|
|
2332
|
+
maxTimeMS?: number | undefined;
|
|
2333
|
+
/**
|
|
2334
|
+
* Optional session to use for this operation
|
|
2335
|
+
*/
|
|
2336
|
+
session?: ClientSession | undefined;
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Returning object from delete write operations
|
|
2340
|
+
*
|
|
2341
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~deleteWriteOpResult
|
|
2342
|
+
*/
|
|
2343
|
+
export interface DeleteWriteOpResultObject {
|
|
2344
|
+
result: {
|
|
2345
|
+
ok?: number | undefined;
|
|
2346
|
+
n?: number | undefined;
|
|
2347
|
+
};
|
|
2348
|
+
connection?: any;
|
|
2349
|
+
deletedCount?: number | undefined;
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Returning object from findAndModify operations
|
|
2353
|
+
*
|
|
2354
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~findAndModifyWriteOpResult
|
|
2355
|
+
*/
|
|
2356
|
+
export interface FindAndModifyWriteOpResultObject<TSchema> {
|
|
2357
|
+
value?: TSchema | undefined;
|
|
2358
|
+
lastErrorObject?: any;
|
|
2359
|
+
ok?: number | undefined;
|
|
2360
|
+
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Returning object from findAndReplace operations
|
|
2363
|
+
*
|
|
2364
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndReplace
|
|
2365
|
+
*/
|
|
2366
|
+
export interface FindOneAndReplaceOption<T> extends CommonOptions {
|
|
2367
|
+
projection?: SchemaMember<T, ProjectionOperators | number | boolean | any> | undefined;
|
|
2368
|
+
sort?: SortOptionObject<T> | undefined;
|
|
2369
|
+
maxTimeMS?: number | undefined;
|
|
2370
|
+
upsert?: boolean | undefined;
|
|
2371
|
+
returnDocument?: 'after' | 'before' | undefined;
|
|
2372
|
+
/** @deprecated Use returnDocument */
|
|
2373
|
+
returnOriginal?: boolean | undefined;
|
|
2374
|
+
collation?: CollationDocument | undefined;
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Possible projection operators
|
|
2378
|
+
*
|
|
2379
|
+
* @see https://docs.mongodb.com/v3.6/reference/operator/projection/
|
|
2380
|
+
*/
|
|
2381
|
+
export interface ProjectionOperators {
|
|
2382
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/projection/elemMatch/#proj._S_elemMatch */
|
|
2383
|
+
$elemMatch?: object | undefined;
|
|
2384
|
+
/** @see https://docs.mongodb.com/v3.6/reference/operator/projection/slice/#proj._S_slice */
|
|
2385
|
+
$slice?: number | [number, number] | undefined;
|
|
2386
|
+
$meta?: MetaProjectionOperators | undefined;
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* Returning object from findOneAndUpdate operations
|
|
2390
|
+
*
|
|
2391
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndUpdate
|
|
2392
|
+
*/
|
|
2393
|
+
export interface FindOneAndUpdateOption<T> extends FindOneAndReplaceOption<T> {
|
|
2394
|
+
arrayFilters?: object[] | undefined;
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* Returning object from findOneAndDelete operations
|
|
2398
|
+
*
|
|
2399
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOneAndDelete
|
|
2400
|
+
*/
|
|
2401
|
+
export interface FindOneAndDeleteOption<T> {
|
|
2402
|
+
projection?: SchemaMember<T, ProjectionOperators | number | boolean | any> | undefined;
|
|
2403
|
+
sort?: SortOptionObject<T> | undefined;
|
|
2404
|
+
maxTimeMS?: number | undefined;
|
|
2405
|
+
session?: ClientSession | undefined;
|
|
2406
|
+
collation?: CollationDocument | undefined;
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* Options for Collection.geoHaystackSearch
|
|
2410
|
+
*
|
|
2411
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#geoHaystackSearch
|
|
2412
|
+
*/
|
|
2413
|
+
export interface GeoHaystackSearchOptions {
|
|
2414
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2415
|
+
maxDistance?: number | undefined;
|
|
2416
|
+
search?: object | undefined;
|
|
2417
|
+
limit?: number | undefined;
|
|
2418
|
+
session?: ClientSession | undefined;
|
|
2419
|
+
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Create a new OrderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly)
|
|
2422
|
+
*
|
|
2423
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/OrderedBulkOperation.html
|
|
2424
|
+
*/
|
|
2425
|
+
export interface OrderedBulkOperation {
|
|
2426
|
+
length: number;
|
|
2427
|
+
/**
|
|
2428
|
+
* Execute the bulk operation
|
|
2429
|
+
*
|
|
2430
|
+
* @param _writeConcern Optional write concern. Can also be specified through options
|
|
2431
|
+
* @param options Optional settings
|
|
2432
|
+
* @param callback A callback that will be invoked when bulkWrite finishes/errors
|
|
2433
|
+
* @returns Promise if no callback is passed
|
|
2434
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/OrderedBulkOperation.html#execute
|
|
2435
|
+
*/
|
|
2436
|
+
execute(callback: MongoCallback<BulkWriteResult>): void;
|
|
2437
|
+
execute(options?: FSyncOptions): Promise<BulkWriteResult>;
|
|
2438
|
+
execute(options: FSyncOptions, callback: MongoCallback<BulkWriteResult>): void;
|
|
2439
|
+
/**
|
|
2440
|
+
* Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
|
|
2441
|
+
* Returns a builder object used to complete the definition of the operation.
|
|
2442
|
+
*
|
|
2443
|
+
* @param selector The selector for the bulk operation. See {@link https://docs.mongodb.com/manual/reference/command/update/#update-command-q q documentation}
|
|
2444
|
+
* @returns helper object with which the write operation can be defined.
|
|
2445
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/OrderedBulkOperation.html#find
|
|
2446
|
+
*/
|
|
2447
|
+
find(selector: object): FindOperators;
|
|
2448
|
+
/**
|
|
2449
|
+
* Add a single insert document to the bulk operation
|
|
2450
|
+
*
|
|
2451
|
+
* @param document the document to insert
|
|
2452
|
+
* @returns reference to self
|
|
2453
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/OrderedBulkOperation.html#insert
|
|
2454
|
+
*/
|
|
2455
|
+
insert(document: object): OrderedBulkOperation;
|
|
2456
|
+
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Returning upserted object from bulkWrite operations
|
|
2459
|
+
*
|
|
2460
|
+
* @see https://docs.mongodb.com/v3.6/reference/method/BulkWriteResult/index.html#BulkWriteResult.upserted
|
|
2461
|
+
*/
|
|
2462
|
+
export interface BulkWriteResultUpsertedIdObject {
|
|
2463
|
+
index: number;
|
|
2464
|
+
_id: ObjectId;
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Returning object from bulkWrite operations
|
|
2468
|
+
*
|
|
2469
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/BulkWriteResult.html
|
|
2470
|
+
*/
|
|
2471
|
+
export interface BulkWriteResult {
|
|
2472
|
+
/**
|
|
2473
|
+
* Evaluates to `true` if the bulk operation correctly executes
|
|
2474
|
+
*/
|
|
2475
|
+
ok: boolean;
|
|
2476
|
+
/**
|
|
2477
|
+
* The number of documents inserted, excluding upserted documents.
|
|
2478
|
+
*/
|
|
2479
|
+
nInserted: number;
|
|
2480
|
+
/**
|
|
2481
|
+
* The number of documents selected for update.
|
|
2482
|
+
*
|
|
2483
|
+
* If the update operation results in no change to the document,
|
|
2484
|
+
* e.g. `$set` expression updates the value to the current value,
|
|
2485
|
+
* nMatched can be greater than nModified.
|
|
2486
|
+
*/
|
|
2487
|
+
nMatched: number;
|
|
2488
|
+
/**
|
|
2489
|
+
* The number of existing documents updated.
|
|
2490
|
+
*
|
|
2491
|
+
* If the update/replacement operation results in no change to the document,
|
|
2492
|
+
* such as setting the value of the field to its current value,
|
|
2493
|
+
* nModified can be less than nMatched
|
|
2494
|
+
*/
|
|
2495
|
+
nModified: number;
|
|
2496
|
+
/**
|
|
2497
|
+
* The number of documents inserted by an {@link https://docs.mongodb.com/v3.6/reference/method/db.collection.update/#upsert-parameter upsert}.
|
|
2498
|
+
*/
|
|
2499
|
+
nUpserted: number;
|
|
2500
|
+
/**
|
|
2501
|
+
* The number of documents removed.
|
|
2502
|
+
*/
|
|
2503
|
+
nRemoved: number;
|
|
2504
|
+
/**
|
|
2505
|
+
* Returns an array of all inserted ids
|
|
2506
|
+
*/
|
|
2507
|
+
getInsertedIds(): object[];
|
|
2508
|
+
/**
|
|
2509
|
+
* Retrieve lastOp if available
|
|
2510
|
+
*/
|
|
2511
|
+
getLastOp(): object;
|
|
2512
|
+
/**
|
|
2513
|
+
* Returns raw internal result
|
|
2514
|
+
*/
|
|
2515
|
+
getRawResponse(): object;
|
|
2516
|
+
/**
|
|
2517
|
+
* Returns the upserted id at the given index
|
|
2518
|
+
*
|
|
2519
|
+
* @param index the number of the upserted id to return, returns `undefined` if no result for passed in index
|
|
2520
|
+
*/
|
|
2521
|
+
getUpsertedIdAt(index: number): BulkWriteResultUpsertedIdObject;
|
|
2522
|
+
/**
|
|
2523
|
+
* Returns an array of all upserted ids
|
|
2524
|
+
*/
|
|
2525
|
+
getUpsertedIds(): BulkWriteResultUpsertedIdObject[];
|
|
2526
|
+
/**
|
|
2527
|
+
* Retrieve the write concern error if any
|
|
2528
|
+
*/
|
|
2529
|
+
getWriteConcernError(): WriteConcernError;
|
|
2530
|
+
/**
|
|
2531
|
+
* Returns a specific write error object
|
|
2532
|
+
*
|
|
2533
|
+
* @param index of the write error to return, returns `null` if there is no result for passed in index
|
|
2534
|
+
*/
|
|
2535
|
+
getWriteErrorAt(index: number): WriteError;
|
|
2536
|
+
/**
|
|
2537
|
+
* Returns the number of write errors off the bulk operation
|
|
2538
|
+
*/
|
|
2539
|
+
getWriteErrorCount(): number;
|
|
2540
|
+
/**
|
|
2541
|
+
* Retrieve all write errors
|
|
2542
|
+
*/
|
|
2543
|
+
getWriteErrors(): object[];
|
|
2544
|
+
/**
|
|
2545
|
+
* Returns `true` if the bulk operation contains a write error
|
|
2546
|
+
*/
|
|
2547
|
+
hasWriteErrors(): boolean;
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* An error that occurred during a BulkWrite on the server.
|
|
2551
|
+
*
|
|
2552
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/WriteError.html
|
|
2553
|
+
*/
|
|
2554
|
+
export interface WriteError {
|
|
2555
|
+
/**
|
|
2556
|
+
* Write concern error code.
|
|
2557
|
+
*/
|
|
2558
|
+
code: number;
|
|
2559
|
+
/**
|
|
2560
|
+
* Write concern error original bulk operation index.
|
|
2561
|
+
*/
|
|
2562
|
+
index: number;
|
|
2563
|
+
/**
|
|
2564
|
+
* Write concern error message.
|
|
2565
|
+
*/
|
|
2566
|
+
errmsg: string;
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* An error representing a failure by the server to apply the requested write concern to the bulk operation.
|
|
2570
|
+
*
|
|
2571
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/WriteConcernError.html
|
|
2572
|
+
*/
|
|
2573
|
+
export interface WriteConcernError {
|
|
2574
|
+
/**
|
|
2575
|
+
* Write concern error code.
|
|
2576
|
+
*/
|
|
2577
|
+
code: number;
|
|
2578
|
+
/**
|
|
2579
|
+
* Write concern error message.
|
|
2580
|
+
*/
|
|
2581
|
+
errmsg: string;
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* A builder object that is returned from {@link https://mongodb.github.io/node-mongodb-native/3.6/api/BulkOperationBase.html#find BulkOperationBase#find}.
|
|
2585
|
+
* Is used to build a write operation that involves a query filter.
|
|
2586
|
+
*
|
|
2587
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html
|
|
2588
|
+
*/
|
|
2589
|
+
export interface FindOperators {
|
|
2590
|
+
/**
|
|
2591
|
+
* Add a delete many operation to the bulk operation
|
|
2592
|
+
*
|
|
2593
|
+
* @returns reference to the parent BulkOperation
|
|
2594
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#delete
|
|
2595
|
+
*/
|
|
2596
|
+
delete(): OrderedBulkOperation;
|
|
2597
|
+
/**
|
|
2598
|
+
* Add a delete one operation to the bulk operation
|
|
2599
|
+
*
|
|
2600
|
+
* @returns reference to the parent BulkOperation
|
|
2601
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#deleteOne
|
|
2602
|
+
*/
|
|
2603
|
+
deleteOne(): OrderedBulkOperation;
|
|
2604
|
+
/**
|
|
2605
|
+
* Backwards compatibility for {@link https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#delete delete()}
|
|
2606
|
+
* @deprecated As of version 3.6.7
|
|
2607
|
+
*
|
|
2608
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#remove
|
|
2609
|
+
*/
|
|
2610
|
+
remove(): OrderedBulkOperation;
|
|
2611
|
+
/**
|
|
2612
|
+
* Backwards compatibility for {@link https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#deleteOne deleteOne()}
|
|
2613
|
+
* @deprecated As of version 3.6.7
|
|
2614
|
+
*
|
|
2615
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#removeOne
|
|
2616
|
+
*/
|
|
2617
|
+
removeOne(): OrderedBulkOperation;
|
|
2618
|
+
/**
|
|
2619
|
+
* Add a replace one operation to the bulk operation
|
|
2620
|
+
*
|
|
2621
|
+
* @param replacement the new document to replace the existing one with
|
|
2622
|
+
* @returns reference to the parent BulkOperation
|
|
2623
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#replaceOne
|
|
2624
|
+
*/
|
|
2625
|
+
replaceOne(replacement: object): OrderedBulkOperation;
|
|
2626
|
+
/**
|
|
2627
|
+
* Add a multiple update operation to the bulk operation
|
|
2628
|
+
*
|
|
2629
|
+
* @param updateDocument An update field for an update operation. See {@link https://docs.mongodb.com/manual/reference/command/update/#update-command-u u documentation}
|
|
2630
|
+
* @param options Optional settings
|
|
2631
|
+
* @returns reference to the parent BulkOperation
|
|
2632
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#update
|
|
2633
|
+
*/
|
|
2634
|
+
update(updateDocument: object, options?: {
|
|
2635
|
+
hint: object;
|
|
2636
|
+
}): OrderedBulkOperation;
|
|
2637
|
+
/**
|
|
2638
|
+
* Add a single update operation to the bulk operation
|
|
2639
|
+
*
|
|
2640
|
+
* @param updateDocument An update field for an update operation. See {@link https://docs.mongodb.com/manual/reference/command/update/#update-command-u u documentation}
|
|
2641
|
+
* @param options Optional settings
|
|
2642
|
+
* @returns reference to the parent BulkOperation
|
|
2643
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#updateOne
|
|
2644
|
+
*/
|
|
2645
|
+
updateOne(updateDocument: object, options?: {
|
|
2646
|
+
hint: object;
|
|
2647
|
+
}): OrderedBulkOperation;
|
|
2648
|
+
/**
|
|
2649
|
+
* Upsert modifier for update bulk operation, noting that this operation is an upsert.
|
|
2650
|
+
*
|
|
2651
|
+
* @returns reference to self
|
|
2652
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/FindOperators.html#upsert
|
|
2653
|
+
*/
|
|
2654
|
+
upsert(): FindOperators;
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly)
|
|
2658
|
+
*
|
|
2659
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/UnorderedBulkOperation.html
|
|
2660
|
+
*/
|
|
2661
|
+
export interface UnorderedBulkOperation {
|
|
2662
|
+
/**
|
|
2663
|
+
* Get the number of operations in the bulk.
|
|
2664
|
+
*/
|
|
2665
|
+
length: number;
|
|
2666
|
+
/**
|
|
2667
|
+
* Execute the bulk operation
|
|
2668
|
+
*
|
|
2669
|
+
* @param _writeConcern Optional write concern. Can also be specified through options.
|
|
2670
|
+
* @param options Optional settings
|
|
2671
|
+
* @param callback A callback that will be invoked when bulkWrite finishes/errors
|
|
2672
|
+
* @returns Promise if no callback is passed
|
|
2673
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/UnorderedBulkOperation.html#execute
|
|
2674
|
+
*/
|
|
2675
|
+
execute(callback: MongoCallback<BulkWriteResult>): void;
|
|
2676
|
+
execute(options?: FSyncOptions): Promise<BulkWriteResult>;
|
|
2677
|
+
execute(options: FSyncOptions, callback: MongoCallback<BulkWriteResult>): void;
|
|
2678
|
+
/**
|
|
2679
|
+
* Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
|
|
2680
|
+
* Returns a builder object used to complete the definition of the operation.
|
|
2681
|
+
*
|
|
2682
|
+
* @param selector The selector for the bulk operation. See {@link https://docs.mongodb.com/manual/reference/command/update/#update-command-q q documentation}
|
|
2683
|
+
* @returns helper object with which the write operation can be defined.
|
|
2684
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/UnorderedBulkOperation.html#find
|
|
2685
|
+
*/
|
|
2686
|
+
find(selector: object): FindOperators;
|
|
2687
|
+
/**
|
|
2688
|
+
* Add a single insert document to the bulk operation
|
|
2689
|
+
*
|
|
2690
|
+
* @param document the document to insert
|
|
2691
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/UnorderedBulkOperation.html#insert
|
|
2692
|
+
*/
|
|
2693
|
+
insert(document: object): UnorderedBulkOperation;
|
|
2694
|
+
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Options for Collection.findOne operations
|
|
2697
|
+
*
|
|
2698
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#findOne
|
|
2699
|
+
*/
|
|
2700
|
+
export interface FindOneOptions<T> {
|
|
2701
|
+
limit?: number | undefined;
|
|
2702
|
+
sort?: Array<[string, number]> | SortOptionObject<T> | undefined;
|
|
2703
|
+
projection?: SchemaMember<T, ProjectionOperators | number | boolean | any> | undefined;
|
|
2704
|
+
/**
|
|
2705
|
+
* @deprecated Use options.projection instead
|
|
2706
|
+
*/
|
|
2707
|
+
fields?: {
|
|
2708
|
+
[P in keyof T]: boolean | number;
|
|
2709
|
+
} | undefined;
|
|
2710
|
+
skip?: number | undefined;
|
|
2711
|
+
hint?: object | undefined;
|
|
2712
|
+
explain?: boolean | undefined;
|
|
2713
|
+
snapshot?: boolean | undefined;
|
|
2714
|
+
timeout?: boolean | undefined;
|
|
2715
|
+
tailable?: boolean | undefined;
|
|
2716
|
+
awaitData?: boolean | undefined;
|
|
2717
|
+
batchSize?: number | undefined;
|
|
2718
|
+
returnKey?: boolean | undefined;
|
|
2719
|
+
maxScan?: number | undefined;
|
|
2720
|
+
min?: number | undefined;
|
|
2721
|
+
max?: number | undefined;
|
|
2722
|
+
showDiskLoc?: boolean | undefined;
|
|
2723
|
+
comment?: string | undefined;
|
|
2724
|
+
raw?: boolean | undefined;
|
|
2725
|
+
promoteLongs?: boolean | undefined;
|
|
2726
|
+
promoteValues?: boolean | undefined;
|
|
2727
|
+
promoteBuffers?: boolean | undefined;
|
|
2728
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2729
|
+
partial?: boolean | undefined;
|
|
2730
|
+
maxTimeMS?: number | undefined;
|
|
2731
|
+
collation?: CollationDocument | undefined;
|
|
2732
|
+
session?: ClientSession | undefined;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Options for Collection.insertOne operations
|
|
2736
|
+
*
|
|
2737
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#insertOne
|
|
2738
|
+
*/
|
|
2739
|
+
export interface CollectionInsertOneOptions extends CommonOptions {
|
|
2740
|
+
/**
|
|
2741
|
+
* Serialize functions on any object.
|
|
2742
|
+
*/
|
|
2743
|
+
serializeFunctions?: boolean | undefined;
|
|
2744
|
+
/**
|
|
2745
|
+
* Force server to assign _id values instead of driver.
|
|
2746
|
+
*/
|
|
2747
|
+
forceServerObjectId?: boolean | undefined;
|
|
2748
|
+
/**
|
|
2749
|
+
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
|
|
2750
|
+
*/
|
|
2751
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2752
|
+
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Returning object from insert write operations
|
|
2755
|
+
*
|
|
2756
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~insertWriteOpResult
|
|
2757
|
+
*/
|
|
2758
|
+
export interface InsertWriteOpResult<TSchema extends {
|
|
2759
|
+
_id: any;
|
|
2760
|
+
}> {
|
|
2761
|
+
insertedCount: number;
|
|
2762
|
+
ops: TSchema[];
|
|
2763
|
+
insertedIds: {
|
|
2764
|
+
[key: number]: TSchema['_id'];
|
|
2765
|
+
};
|
|
2766
|
+
connection: any;
|
|
2767
|
+
result: {
|
|
2768
|
+
ok: number;
|
|
2769
|
+
n: number;
|
|
2770
|
+
};
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Returning object from insertOne write operations
|
|
2774
|
+
*
|
|
2775
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~insertOneWriteOpResult
|
|
2776
|
+
*/
|
|
2777
|
+
export interface InsertOneWriteOpResult<TSchema extends {
|
|
2778
|
+
_id: any;
|
|
2779
|
+
}> {
|
|
2780
|
+
insertedCount: number;
|
|
2781
|
+
ops: TSchema[];
|
|
2782
|
+
insertedId: TSchema['_id'];
|
|
2783
|
+
connection: any;
|
|
2784
|
+
result: {
|
|
2785
|
+
ok: number;
|
|
2786
|
+
n: number;
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Options for Collection.parallelCollectionScan operations
|
|
2791
|
+
*
|
|
2792
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#parallelCollectionScan
|
|
2793
|
+
*/
|
|
2794
|
+
export interface ParallelCollectionScanOptions {
|
|
2795
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2796
|
+
batchSize?: number | undefined;
|
|
2797
|
+
numCursors?: number | undefined;
|
|
2798
|
+
raw?: boolean | undefined;
|
|
2799
|
+
session?: ClientSession | undefined;
|
|
2800
|
+
}
|
|
2801
|
+
/**
|
|
2802
|
+
* Options for Collection.replaceOne operations
|
|
2803
|
+
*
|
|
2804
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#replaceOne
|
|
2805
|
+
*/
|
|
2806
|
+
export interface ReplaceOneOptions extends CommonOptions {
|
|
2807
|
+
upsert?: boolean | undefined;
|
|
2808
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Options for Collection.updateOne operations
|
|
2812
|
+
*
|
|
2813
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#updateOne
|
|
2814
|
+
*/
|
|
2815
|
+
export interface UpdateOneOptions extends ReplaceOneOptions {
|
|
2816
|
+
arrayFilters?: object[] | undefined;
|
|
2817
|
+
}
|
|
2818
|
+
/**
|
|
2819
|
+
* Options for Collection.updateMany operations
|
|
2820
|
+
*
|
|
2821
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#updateMany
|
|
2822
|
+
*/
|
|
2823
|
+
export interface UpdateManyOptions extends CommonOptions {
|
|
2824
|
+
upsert?: boolean | undefined;
|
|
2825
|
+
arrayFilters?: object[] | undefined;
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Returning object from update write operations
|
|
2829
|
+
*
|
|
2830
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~updateWriteOpResult
|
|
2831
|
+
*/
|
|
2832
|
+
export interface UpdateWriteOpResult {
|
|
2833
|
+
result: {
|
|
2834
|
+
ok: number;
|
|
2835
|
+
n: number;
|
|
2836
|
+
nModified: number;
|
|
2837
|
+
};
|
|
2838
|
+
connection: any;
|
|
2839
|
+
matchedCount: number;
|
|
2840
|
+
modifiedCount: number;
|
|
2841
|
+
upsertedCount: number;
|
|
2842
|
+
upsertedId: {
|
|
2843
|
+
_id: ObjectId;
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2846
|
+
/**
|
|
2847
|
+
* Returning object from replace write operations
|
|
2848
|
+
*
|
|
2849
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~updateWriteOpResult
|
|
2850
|
+
*/
|
|
2851
|
+
export interface ReplaceWriteOpResult extends UpdateWriteOpResult {
|
|
2852
|
+
ops: any[];
|
|
2853
|
+
}
|
|
2854
|
+
/**
|
|
2855
|
+
* Options for Collection.mapReduce operations
|
|
2856
|
+
*
|
|
2857
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#mapReduce
|
|
2858
|
+
*/
|
|
2859
|
+
export interface MapReduceOptions {
|
|
2860
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2861
|
+
out?: object | undefined;
|
|
2862
|
+
query?: object | undefined;
|
|
2863
|
+
sort?: object | undefined;
|
|
2864
|
+
limit?: number | undefined;
|
|
2865
|
+
keeptemp?: boolean | undefined;
|
|
2866
|
+
finalize?: Function | string | undefined;
|
|
2867
|
+
scope?: object | undefined;
|
|
2868
|
+
jsMode?: boolean | undefined;
|
|
2869
|
+
verbose?: boolean | undefined;
|
|
2870
|
+
bypassDocumentValidation?: boolean | undefined;
|
|
2871
|
+
session?: ClientSession | undefined;
|
|
2872
|
+
}
|
|
2873
|
+
export declare type CollectionMapFunction<TSchema> = (this: TSchema) => void;
|
|
2874
|
+
export declare type CollectionReduceFunction<TKey, TValue> = (key: TKey, values: TValue[]) => TValue;
|
|
2875
|
+
/**
|
|
2876
|
+
* Returning object from write operations
|
|
2877
|
+
*
|
|
2878
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#~WriteOpResult
|
|
2879
|
+
*/
|
|
2880
|
+
export interface WriteOpResult {
|
|
2881
|
+
ops: any[];
|
|
2882
|
+
connection: any;
|
|
2883
|
+
result: any;
|
|
2884
|
+
}
|
|
2885
|
+
/**
|
|
2886
|
+
* Callback for cursor operations
|
|
2887
|
+
*
|
|
2888
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Cursor.html#~resultCallback
|
|
2889
|
+
*/
|
|
2890
|
+
export declare type CursorResult = object | null | boolean;
|
|
2891
|
+
declare type DefaultSchema = any;
|
|
2892
|
+
/**
|
|
2893
|
+
* Options for Cursor.count() operations.
|
|
2894
|
+
*
|
|
2895
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Cursor.html#count
|
|
2896
|
+
*/
|
|
2897
|
+
export interface CursorCommentOptions {
|
|
2898
|
+
skip?: number | undefined;
|
|
2899
|
+
limit?: number | undefined;
|
|
2900
|
+
maxTimeMS?: number | undefined;
|
|
2901
|
+
hint?: string | undefined;
|
|
2902
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* The callback format for the forEach iterator method
|
|
2906
|
+
*
|
|
2907
|
+
* @param doc An emitted document for the iterator
|
|
2908
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Cursor.html#~iteratorCallback
|
|
2909
|
+
*/
|
|
2910
|
+
export interface IteratorCallback<T> {
|
|
2911
|
+
(doc: T): void;
|
|
2912
|
+
}
|
|
2913
|
+
/**
|
|
2914
|
+
* The callback error format for the forEach iterator method
|
|
2915
|
+
*
|
|
2916
|
+
* @param error An error instance representing the error during the execution.
|
|
2917
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/Cursor.html#~endCallback
|
|
2918
|
+
*/
|
|
2919
|
+
export interface EndCallback {
|
|
2920
|
+
(error: MongoError): void;
|
|
2921
|
+
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Returning object for the AggregationCursor result callback
|
|
2924
|
+
*
|
|
2925
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/AggregationCursor.html#~resultCallback
|
|
2926
|
+
*/
|
|
2927
|
+
export declare type AggregationCursorResult = object | null;
|
|
2928
|
+
/**
|
|
2929
|
+
* Result object from CommandCursor.resultCallback
|
|
2930
|
+
*
|
|
2931
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/CommandCursor.html#~resultCallback
|
|
2932
|
+
*/
|
|
2933
|
+
export declare type CommandCursorResult = object | null;
|
|
2934
|
+
/**
|
|
2935
|
+
* Options for creating a new GridFSBucket
|
|
2936
|
+
*
|
|
2937
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucket.html
|
|
2938
|
+
*/
|
|
2939
|
+
export interface GridFSBucketOptions {
|
|
2940
|
+
bucketName?: string | undefined;
|
|
2941
|
+
chunkSizeBytes?: number | undefined;
|
|
2942
|
+
writeConcern?: WriteConcern | undefined;
|
|
2943
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
2944
|
+
}
|
|
2945
|
+
/**
|
|
2946
|
+
* Callback format for all GridFSBucket methods that can accept a callback.
|
|
2947
|
+
*
|
|
2948
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucket.html#~errorCallback
|
|
2949
|
+
*/
|
|
2950
|
+
export interface GridFSBucketErrorCallback extends MongoCallback<void> {
|
|
2951
|
+
}
|
|
2952
|
+
/**
|
|
2953
|
+
* Options for GridFSBucket.find() operations
|
|
2954
|
+
*
|
|
2955
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucket.html#find
|
|
2956
|
+
*/
|
|
2957
|
+
export interface GridFSBucketFindOptions {
|
|
2958
|
+
batchSize?: number | undefined;
|
|
2959
|
+
limit?: number | undefined;
|
|
2960
|
+
maxTimeMS?: number | undefined;
|
|
2961
|
+
noCursorTimeout?: boolean | undefined;
|
|
2962
|
+
skip?: number | undefined;
|
|
2963
|
+
sort?: object | undefined;
|
|
2964
|
+
}
|
|
2965
|
+
/**
|
|
2966
|
+
* Options for GridFSBucket.openUploadStream() operations
|
|
2967
|
+
*
|
|
2968
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucket.html#openUploadStream
|
|
2969
|
+
*/
|
|
2970
|
+
export interface GridFSBucketOpenUploadStreamOptions {
|
|
2971
|
+
chunkSizeBytes?: number | undefined;
|
|
2972
|
+
metadata?: object | undefined;
|
|
2973
|
+
contentType?: string | undefined;
|
|
2974
|
+
aliases?: string[] | undefined;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Options for creating a new GridFSBucketReadStream
|
|
2978
|
+
*
|
|
2979
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucketReadStream.html
|
|
2980
|
+
*/
|
|
2981
|
+
export interface GridFSBucketReadStreamOptions {
|
|
2982
|
+
sort?: number | undefined;
|
|
2983
|
+
skip?: number | undefined;
|
|
2984
|
+
start?: number | undefined;
|
|
2985
|
+
end?: number | undefined;
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Options for creating a new GridFSBucketWriteStream
|
|
2989
|
+
*
|
|
2990
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucketWriteStream.html
|
|
2991
|
+
*/
|
|
2992
|
+
export interface GridFSBucketWriteStreamOptions extends WriteConcern {
|
|
2993
|
+
/**
|
|
2994
|
+
* Custom file id for the GridFS file.
|
|
2995
|
+
*/
|
|
2996
|
+
id?: GridFSBucketWriteStreamId | undefined;
|
|
2997
|
+
/**
|
|
2998
|
+
* The chunk size to use, in bytes
|
|
2999
|
+
*/
|
|
3000
|
+
chunkSizeBytes?: number | undefined;
|
|
3001
|
+
/**
|
|
3002
|
+
* If true, disables adding an md5 field to file data
|
|
3003
|
+
* @default false
|
|
3004
|
+
*/
|
|
3005
|
+
disableMD5?: boolean | undefined;
|
|
3006
|
+
}
|
|
3007
|
+
export declare type ChangeEventTypes = 'insert' | 'delete' | 'replace' | 'update' | 'drop' | 'rename' | 'dropDatabase' | 'invalidate';
|
|
3008
|
+
export interface ChangeEventBase<TSchema extends {
|
|
3009
|
+
[key: string]: any;
|
|
3010
|
+
} = DefaultSchema> {
|
|
3011
|
+
_id: ResumeToken;
|
|
3012
|
+
/**
|
|
3013
|
+
* We leave this off the base type so that we can differentiate
|
|
3014
|
+
* by checking its value and get intelligent types on the other fields
|
|
3015
|
+
*/
|
|
3016
|
+
ns: {
|
|
3017
|
+
db: string;
|
|
3018
|
+
coll: string;
|
|
3019
|
+
};
|
|
3020
|
+
clusterTime: Timestamp;
|
|
3021
|
+
txnNumber?: number | undefined;
|
|
3022
|
+
lsid?: {
|
|
3023
|
+
id: any;
|
|
3024
|
+
uid: any;
|
|
3025
|
+
} | undefined;
|
|
3026
|
+
}
|
|
3027
|
+
export interface ChangeEventCR<TSchema extends {
|
|
3028
|
+
[key: string]: any;
|
|
3029
|
+
} = DefaultSchema> extends ChangeEventBase<TSchema> {
|
|
3030
|
+
operationType: 'insert' | 'replace';
|
|
3031
|
+
fullDocument?: TSchema | undefined;
|
|
3032
|
+
documentKey: {
|
|
3033
|
+
_id: ExtractIdType<TSchema>;
|
|
3034
|
+
};
|
|
3035
|
+
}
|
|
3036
|
+
declare type FieldUpdates<TSchema> = Partial<TSchema> & {
|
|
3037
|
+
[key: string]: any;
|
|
3038
|
+
};
|
|
3039
|
+
export interface ChangeEventUpdate<TSchema extends {
|
|
3040
|
+
[key: string]: any;
|
|
3041
|
+
} = DefaultSchema> extends ChangeEventBase<TSchema> {
|
|
3042
|
+
operationType: 'update';
|
|
3043
|
+
updateDescription: {
|
|
3044
|
+
/**
|
|
3045
|
+
* This is an object with all changed fields; if they are nested,
|
|
3046
|
+
* the keys will be paths, e.g. 'question.answer.0.text': 'new text'
|
|
3047
|
+
*/
|
|
3048
|
+
updatedFields: FieldUpdates<TSchema>;
|
|
3049
|
+
removedFields: Array<keyof TSchema | string>;
|
|
3050
|
+
};
|
|
3051
|
+
fullDocument?: TSchema | undefined;
|
|
3052
|
+
documentKey: {
|
|
3053
|
+
_id: ExtractIdType<TSchema>;
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
export interface ChangeEventDelete<TSchema extends {
|
|
3057
|
+
[key: string]: any;
|
|
3058
|
+
} = DefaultSchema> extends ChangeEventBase<TSchema> {
|
|
3059
|
+
operationType: 'delete';
|
|
3060
|
+
documentKey: {
|
|
3061
|
+
_id: ExtractIdType<TSchema>;
|
|
3062
|
+
};
|
|
3063
|
+
}
|
|
3064
|
+
export interface ChangeEventRename<TSchema extends {
|
|
3065
|
+
[key: string]: any;
|
|
3066
|
+
} = DefaultSchema> extends ChangeEventBase<TSchema> {
|
|
3067
|
+
operationType: 'rename';
|
|
3068
|
+
to: {
|
|
3069
|
+
db: string;
|
|
3070
|
+
coll: string;
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3073
|
+
export interface ChangeEventOther<TSchema extends {
|
|
3074
|
+
[key: string]: any;
|
|
3075
|
+
} = DefaultSchema> extends ChangeEventBase<TSchema> {
|
|
3076
|
+
operationType: 'drop' | 'dropDatabase';
|
|
3077
|
+
}
|
|
3078
|
+
export interface ChangeEventInvalidate<TSchema extends {
|
|
3079
|
+
[key: string]: any;
|
|
3080
|
+
} = DefaultSchema> {
|
|
3081
|
+
_id: ResumeToken;
|
|
3082
|
+
operationType: 'invalidate';
|
|
3083
|
+
clusterTime: Timestamp;
|
|
3084
|
+
}
|
|
3085
|
+
export declare type ChangeEvent<TSchema extends object = {
|
|
3086
|
+
_id: ObjectId;
|
|
3087
|
+
}> = ChangeEventCR<TSchema> | ChangeEventUpdate<TSchema> | ChangeEventDelete<TSchema> | ChangeEventRename<TSchema> | ChangeEventOther<TSchema> | ChangeEventInvalidate<TSchema>;
|
|
3088
|
+
/**
|
|
3089
|
+
* Options that can be passed to a `ChangeStream`.
|
|
3090
|
+
* Note that `startAfter`, `resumeAfter`, and `startAtOperationTime` are all mutually exclusive, and the server will error if more than one is specified.
|
|
3091
|
+
*
|
|
3092
|
+
* @see https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#ChangeStreamOptions
|
|
3093
|
+
*/
|
|
3094
|
+
export interface ChangeStreamOptions {
|
|
3095
|
+
fullDocument?: 'default' | 'updateLookup' | undefined;
|
|
3096
|
+
maxAwaitTimeMS?: number | undefined;
|
|
3097
|
+
resumeAfter?: ResumeToken | undefined;
|
|
3098
|
+
startAfter?: ResumeToken | undefined;
|
|
3099
|
+
startAtOperationTime?: Timestamp | undefined;
|
|
3100
|
+
batchSize?: number | undefined;
|
|
3101
|
+
collation?: CollationDocument | undefined;
|
|
3102
|
+
readPreference?: ReadPreferenceOrMode | undefined;
|
|
3103
|
+
}
|
|
3104
|
+
declare type GridFSBucketWriteStreamId = string | number | object | ObjectId;
|
|
3105
|
+
export interface LoggerOptions {
|
|
3106
|
+
/**
|
|
3107
|
+
* Custom logger function
|
|
3108
|
+
*/
|
|
3109
|
+
loggerLevel?: string | undefined;
|
|
3110
|
+
/**
|
|
3111
|
+
* Override default global log level.
|
|
3112
|
+
*/
|
|
3113
|
+
logger?: log | undefined;
|
|
3114
|
+
}
|
|
3115
|
+
export declare type log = (message?: string, state?: LoggerState) => void;
|
|
3116
|
+
export interface LoggerState {
|
|
3117
|
+
type: string;
|
|
3118
|
+
message: string;
|
|
3119
|
+
className: string;
|
|
3120
|
+
pid: number;
|
|
3121
|
+
date: number;
|
|
3122
|
+
}
|
|
3123
|
+
/**
|
|
3124
|
+
* Possible fields for a collation document
|
|
3125
|
+
*
|
|
3126
|
+
* @see https://docs.mongodb.com/v3.6/reference/collation/#collation-document-fields
|
|
3127
|
+
*/
|
|
3128
|
+
export interface CollationDocument {
|
|
3129
|
+
locale: string;
|
|
3130
|
+
strength?: number | undefined;
|
|
3131
|
+
caseLevel?: boolean | undefined;
|
|
3132
|
+
caseFirst?: string | undefined;
|
|
3133
|
+
numericOrdering?: boolean | undefined;
|
|
3134
|
+
alternate?: string | undefined;
|
|
3135
|
+
maxVariable?: string | undefined;
|
|
3136
|
+
backwards?: boolean | undefined;
|
|
3137
|
+
normalization?: boolean | undefined;
|
|
3138
|
+
}
|
|
3139
|
+
/**
|
|
3140
|
+
* Possible indexes to create inside a collection
|
|
3141
|
+
*
|
|
3142
|
+
* @see https://docs.mongodb.com/v3.6/reference/command/createIndexes/
|
|
3143
|
+
*/
|
|
3144
|
+
export interface IndexSpecification {
|
|
3145
|
+
key: object;
|
|
3146
|
+
name?: string | undefined;
|
|
3147
|
+
background?: boolean | undefined;
|
|
3148
|
+
unique?: boolean | undefined;
|
|
3149
|
+
partialFilterExpression?: object | undefined;
|
|
3150
|
+
sparse?: boolean | undefined;
|
|
3151
|
+
expireAfterSeconds?: number | undefined;
|
|
3152
|
+
storageEngine?: object | undefined;
|
|
3153
|
+
weights?: object | undefined;
|
|
3154
|
+
default_language?: string | undefined;
|
|
3155
|
+
language_override?: string | undefined;
|
|
3156
|
+
textIndexVersion?: number | undefined;
|
|
3157
|
+
'2dsphereIndexVersion'?: number | undefined;
|
|
3158
|
+
bits?: number | undefined;
|
|
3159
|
+
min?: number | undefined;
|
|
3160
|
+
max?: number | undefined;
|
|
3161
|
+
bucketSize?: number | undefined;
|
|
3162
|
+
collation?: CollationDocument | undefined;
|
|
3163
|
+
}
|