├── packages ├── i18n │ ├── README.md │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── src │ │ ├── index.ts │ │ └── locales │ │ │ └── de_DE.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── java-shell │ ├── index.js │ ├── cli │ │ └── .gitignore │ ├── src │ │ ├── test │ │ │ └── resources │ │ │ │ ├── cursor │ │ │ │ ├── itcount.expected.txt │ │ │ │ ├── isClosed.expected.txt │ │ │ │ ├── aggregateExplain.expected.txt │ │ │ │ ├── isClosedTrue.expected.txt │ │ │ │ ├── aggregateIsClosed.expected.txt │ │ │ │ ├── map.expected.txt │ │ │ │ ├── maxTimeMS.expected.txt │ │ │ │ ├── cursorHelp.expected.txt │ │ │ │ ├── max.expected.txt │ │ │ │ ├── batchSize.expected.txt │ │ │ │ ├── noCursorTimeout.expected.txt │ │ │ │ ├── mapArrowFunction.expected.txt │ │ │ │ ├── returnKey.expected.txt │ │ │ │ ├── limit.expected.txt │ │ │ │ ├── min.expected.txt │ │ │ │ ├── next.expected.txt │ │ │ │ ├── skip.expected.txt │ │ │ │ ├── explain.expected.txt │ │ │ │ ├── projection.expected.txt │ │ │ │ ├── comment.expected.txt │ │ │ │ ├── hint.expected.txt │ │ │ │ ├── sort.expected.txt │ │ │ │ ├── forEach.expected.txt │ │ │ │ ├── collation.expected.txt │ │ │ │ ├── readPref.expected.txt │ │ │ │ ├── toArray.expected.txt │ │ │ │ ├── cursorHelp.js │ │ │ │ ├── readConcern.expected.txt │ │ │ │ ├── isClosedTrue.js │ │ │ │ ├── tailable.expected.1.txt │ │ │ │ ├── maxTimeMS.js │ │ │ │ ├── noCursorTimeout.js │ │ │ │ ├── tailable.expected.txt │ │ │ │ ├── limit.js │ │ │ │ ├── readConcern.js │ │ │ │ ├── skip.js │ │ │ │ ├── tailable.js │ │ │ │ ├── batchSize.js │ │ │ │ ├── itcount.js │ │ │ │ ├── comment.js │ │ │ │ ├── hint.js │ │ │ │ ├── isClosed.js │ │ │ │ ├── sort.js │ │ │ │ ├── collation.js │ │ │ │ ├── max.js │ │ │ │ ├── min.js │ │ │ │ ├── projection.js │ │ │ │ ├── map.js │ │ │ │ ├── mapArrowFunction.js │ │ │ │ ├── toArray.js │ │ │ │ ├── aggregateIsClosed.js │ │ │ │ ├── next.js │ │ │ │ ├── returnKey.js │ │ │ │ ├── forEach.js │ │ │ │ ├── aggregateReadPref.expected.txt │ │ │ │ ├── print.expected.txt │ │ │ │ ├── print.js │ │ │ │ └── aggregateExplain.js │ │ │ │ ├── collection │ │ │ │ ├── drop.expected.txt │ │ │ │ ├── countDocuments.expected.txt │ │ │ │ ├── countWithLimit.expected.txt │ │ │ │ ├── countWithQuery.expected.txt │ │ │ │ ├── emptyCollection.expected.txt │ │ │ │ ├── stats.expected.txt │ │ │ │ ├── aggregateWithExplain.expected.txt │ │ │ │ ├── estimatedDocumentCount.expected.txt │ │ │ │ ├── ref.expected.txt │ │ │ │ ├── ref.js │ │ │ │ ├── totalIndexSize.expected.txt │ │ │ │ ├── findAndCount.expected.txt │ │ │ │ ├── estimatedDocumentCountWithMaxTime.expected.txt │ │ │ │ ├── findMap.expected.txt │ │ │ │ ├── findOne.expected.txt │ │ │ │ ├── collectionHelp.expected.txt │ │ │ │ ├── isCapped.expected.txt │ │ │ │ ├── deleteMany.expected.txt │ │ │ │ ├── deleteOne.expected.txt │ │ │ │ ├── findWithProjection.expected.txt │ │ │ │ ├── aggregate.expected.txt │ │ │ │ ├── getIndexes.expected.1.txt │ │ │ │ ├── createIndexes.expected.txt │ │ │ │ ├── renameCollection.expected.txt │ │ │ │ ├── aggregateAllowDiskUse.expected.txt │ │ │ │ ├── aggregateWithMaxTime.expected.txt │ │ │ │ ├── findWithQuery.expected.txt │ │ │ │ ├── aggregateWithBatchSize.expected.txt │ │ │ │ ├── aggregateWithCollation.expected.txt │ │ │ │ ├── aggregateWithReadConcern.expected.txt │ │ │ │ ├── aggregateWithoutArray.expected.txt │ │ │ │ ├── findOneAndReplace.expected.txt │ │ │ │ ├── getIndexes.expected.txt │ │ │ │ ├── renameCollectionDropTarget.expected.txt │ │ │ │ ├── insertOneWrongWriteConcern2.expected.txt │ │ │ │ ├── dropIndexes.expected.1.txt │ │ │ │ ├── emptyCollection.js │ │ │ │ ├── findOneAndDelete.expected.txt │ │ │ │ ├── findOneAndReplaceWithReturnDocument.expected.txt │ │ │ │ ├── withPeriod.expected.txt │ │ │ │ ├── countWithUnknownOption.expected.txt │ │ │ │ ├── insertOneWriteConcern.expected.txt │ │ │ │ ├── collectionHelp.js │ │ │ │ ├── find.expected.txt │ │ │ │ ├── insertOneWrongWriteConcern.expected.txt │ │ │ │ ├── count.expected.txt │ │ │ │ ├── dropIndexes.expected.txt │ │ │ │ ├── findWithRegexp.expected.txt │ │ │ │ ├── replaceOne.expected.txt │ │ │ │ ├── dropIndex.expected.1.txt │ │ │ │ ├── updateOneUpsert.expected.txt │ │ │ │ ├── bulkWriteException.expected.txt │ │ │ │ ├── distinct.expected.txt │ │ │ │ ├── drop.js │ │ │ │ ├── findWithRegexpCaseInsensitive.expected.txt │ │ │ │ ├── findOneAndUpdate.expected.txt │ │ │ │ ├── insertMany.expected.txt │ │ │ │ ├── getIndexes.js │ │ │ │ ├── bulkWriteException.js │ │ │ │ ├── dropIndex.expected.txt │ │ │ │ ├── stats.js │ │ │ │ ├── findAndModify.expected.txt │ │ │ │ ├── replaceOneUpsert.expected.txt │ │ │ │ ├── findAndModifyWithNew.expected.txt │ │ │ │ ├── findOneAndUpdateWithReturnDocument.expected.txt │ │ │ │ ├── findOne.js │ │ │ │ ├── insertMany.js │ │ │ │ ├── createIndex.expected.txt │ │ │ │ ├── findMap.js │ │ │ │ ├── updateManyPipeline.expected.txt │ │ │ │ ├── updateOne.expected.txt │ │ │ │ ├── updateOnePipeline.expected.txt │ │ │ │ ├── updateOneUpsert.js │ │ │ │ ├── insertOneWrongWriteConcern.js │ │ │ │ ├── insertOneWrongWriteConcern2.js │ │ │ │ ├── count.js │ │ │ │ ├── find.js │ │ │ │ ├── replaceOne.js │ │ │ │ ├── updateMany.expected.txt │ │ │ │ ├── findOneAndReplace.js │ │ │ │ ├── insertOneWriteConcern.js │ │ │ │ ├── totalIndexSize.js │ │ │ │ ├── countDocuments.js │ │ │ │ ├── findWithQuery.js │ │ │ │ ├── replaceOneUpsert.js │ │ │ │ ├── updateManyUpsert.expected.txt │ │ │ │ ├── countWithQuery.js │ │ │ │ ├── findWithProjection.js │ │ │ │ ├── estimatedDocumentCount.js │ │ │ │ ├── findWithRegexp.js │ │ │ │ ├── findWithRegexpCaseInsensitive.js │ │ │ │ ├── uniqueIndex.expected.txt │ │ │ │ ├── countWithLimit.js │ │ │ │ ├── findOneAndDelete.js │ │ │ │ ├── findOneAndReplaceWithReturnDocument.js │ │ │ │ ├── isCapped.js │ │ │ │ ├── withPeriod.js │ │ │ │ ├── uniqueIndex.expected.1.txt │ │ │ │ ├── countWithUnknownOption.js │ │ │ │ ├── estimatedDocumentCountWithMaxTime.js │ │ │ │ ├── updateMany.js │ │ │ │ ├── updateOne.js │ │ │ │ ├── findAndModify.js │ │ │ │ ├── insertManyNotOrdered.js │ │ │ │ ├── aggregateWithNegativeBatchSize.expected.txt │ │ │ │ ├── renameCollection.js │ │ │ │ ├── updateManyUpsert.js │ │ │ │ ├── findAndCount.js │ │ │ │ ├── findAndModifyWithNew.js │ │ │ │ ├── updateManyPipeline.js │ │ │ │ ├── updateOnePipeline.js │ │ │ │ ├── findOneAndUpdate.js │ │ │ │ ├── findOneAndUpdateWithReturnDocument.js │ │ │ │ ├── insertManyNotOrdered.expected.txt │ │ │ │ ├── insertManyNotOrdered.expected.1.txt │ │ │ │ ├── aggregateWithNegativeBatchSize.expected.4.txt │ │ │ │ ├── renameCollectionAlreadyExists.js │ │ │ │ ├── renameCollectionDropTarget.js │ │ │ │ ├── renameCollectionAlreadyExists.expected.txt │ │ │ │ ├── aggregateWithNegativeBatchSize.expected.2.txt │ │ │ │ ├── aggregateWithNegativeBatchSize.expected.1.txt │ │ │ │ ├── aggregateWithNegativeBatchSize.expected.3.txt │ │ │ │ ├── uniqueIndex.js │ │ │ │ └── dropIndexes.js │ │ │ │ ├── db │ │ │ │ ├── defaultDb.expected.txt │ │ │ │ ├── runCommand.expected.txt │ │ │ │ ├── defaultDb.js │ │ │ │ ├── showDatabases.expected.txt │ │ │ │ ├── version.expected.txt │ │ │ │ ├── dbHelp.expected.txt │ │ │ │ ├── getName.expected.txt │ │ │ │ ├── useDb.expected.txt │ │ │ │ ├── serverStatus.expected.txt │ │ │ │ ├── useDb.js │ │ │ │ ├── version.js │ │ │ │ ├── getCollection.expected.txt │ │ │ │ ├── getName.js │ │ │ │ ├── help.expected.txt │ │ │ │ ├── dropDatabase.js │ │ │ │ ├── runCommand.js │ │ │ │ ├── showDatabases.js │ │ │ │ ├── dropDatabase.expected.txt │ │ │ │ ├── getCollection.js │ │ │ │ ├── runCommandUserInfo.js │ │ │ │ ├── dbHelp.js │ │ │ │ ├── showCollections.expected.txt │ │ │ │ ├── serverStatus.js │ │ │ │ ├── createCollectionWithTimeseries.expected.txt │ │ │ │ ├── createView.expected.txt │ │ │ │ ├── showCollections.js │ │ │ │ ├── createCollection.expected.txt │ │ │ │ ├── help.js │ │ │ │ ├── getCollectionInfos.expected.1.txt │ │ │ │ ├── runCommandUserInfo.expected.txt │ │ │ │ ├── getCollectionInfos.expected.txt │ │ │ │ └── getCollectionInfos.js │ │ │ │ └── literal │ │ │ │ ├── undefined.expected.txt │ │ │ │ ├── DateNow.expected.txt │ │ │ │ ├── int.expected.txt │ │ │ │ ├── bsonsize.expected.txt │ │ │ │ ├── double.expected.txt │ │ │ │ ├── float.expected.txt │ │ │ │ ├── null.expected.txt │ │ │ │ ├── emptyArray.expected.txt │ │ │ │ ├── double.js │ │ │ │ ├── emptyObject.expected.txt │ │ │ │ ├── float.js │ │ │ │ ├── int.js │ │ │ │ ├── null.js │ │ │ │ ├── string.expected.txt │ │ │ │ ├── DateNow.js │ │ │ │ ├── Symbol.expected.txt │ │ │ │ ├── bsonsize.js │ │ │ │ ├── emptyArray.js │ │ │ │ ├── undefined.js │ │ │ │ ├── unknownSymbol.js │ │ │ │ ├── bool.expected.txt │ │ │ │ ├── string.js │ │ │ │ ├── NumberInt.expected.txt │ │ │ │ ├── NumberLong.expected.txt │ │ │ │ ├── BSONSymbol.expected.txt │ │ │ │ ├── unknownSymbol.expected.txt │ │ │ │ ├── emptyObject.js │ │ │ │ ├── array.expected.txt │ │ │ │ ├── object.expected.txt │ │ │ │ ├── Symbol-ignored.js │ │ │ │ ├── long.expected.txt │ │ │ │ ├── MaxKey.expected.txt │ │ │ │ ├── MinKey.expected.txt │ │ │ │ ├── NumberDecimal.expected.txt │ │ │ │ ├── long.expected.1.txt │ │ │ │ ├── long.expected.2.txt │ │ │ │ ├── DBRef.expected.txt │ │ │ │ ├── object.js │ │ │ │ ├── Code.expected.txt │ │ │ │ ├── Timestamp.expected.txt │ │ │ │ ├── long.js │ │ │ │ ├── ObjectId.expected.txt │ │ │ │ ├── UUID.expected.txt │ │ │ │ ├── bool.js │ │ │ │ ├── MD5.expected.txt │ │ │ │ ├── HexData.expected.txt │ │ │ │ ├── Timestamp.js │ │ │ │ ├── NumberDecimal.js │ │ │ │ ├── array.js │ │ │ │ ├── DBRef.js │ │ │ │ ├── MaxKey.js │ │ │ │ ├── MinKey.js │ │ │ │ ├── MD5.js │ │ │ │ ├── NumberInt.js │ │ │ │ ├── BSONSymbol.js │ │ │ │ ├── Code.js │ │ │ │ ├── NumberLong.js │ │ │ │ ├── HexData.js │ │ │ │ ├── BinData.expected.txt │ │ │ │ └── ObjectId.js │ │ └── main │ │ │ └── kotlin │ │ │ └── com │ │ │ └── mongodb │ │ │ └── mongosh │ │ │ ├── result │ │ │ ├── CommandException.kt │ │ │ └── FindCursor.kt │ │ │ └── MongoshDate.kt │ ├── .gitignore │ ├── tsconfig.json │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── tsconfig-lint.json │ ├── settings.gradle │ └── .mocharc.json ├── autocomplete │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── src │ │ └── node_modules │ │ │ └── mongodb-ace-autocompleter │ │ │ └── index.d.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── build │ ├── .gitignore │ ├── test │ │ └── fixtures │ │ │ ├── msi-template │ │ │ └── BUILD │ │ │ │ └── .keep │ │ │ ├── rpm-template │ │ │ ├── BUILD │ │ │ │ └── .keep │ │ │ ├── RPMS │ │ │ │ └── .keep │ │ │ ├── SRPMS │ │ │ │ └── .keep │ │ │ └── BUILDROOT │ │ │ │ └── .keep │ │ │ ├── bin │ │ │ ├── bar │ │ │ ├── foo │ │ │ └── curator │ │ │ ├── README │ │ │ ├── LICENSE-bar │ │ │ ├── LICENSE-foo │ │ │ ├── manpages.tar.gz │ │ │ └── deb-template │ │ │ └── DEBIAN │ │ │ └── control │ ├── examples │ │ ├── input.js │ │ └── fake-curator.tar.gz │ ├── .eslintignore │ ├── src │ │ ├── compile │ │ │ └── index.ts │ │ ├── local │ │ │ └── index.ts │ │ ├── homebrew │ │ │ └── index.ts │ │ ├── evergreen │ │ │ └── index.ts │ │ ├── download-center │ │ │ └── index.ts │ │ ├── git │ │ │ └── index.ts │ │ ├── helpers │ │ │ └── index.ts │ │ ├── packaging │ │ │ ├── package │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── npm-packages │ │ │ ├── index.ts │ │ │ └── types.ts │ │ └── config │ │ │ ├── index.ts │ │ │ └── platform.ts │ ├── .prettierrc.json │ ├── build.png │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .mocharc.json │ ├── .npmignore │ └── tsconfig.json ├── editor │ ├── .gitignore │ ├── .eslintignore │ ├── src │ │ └── index.ts │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── README.md │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── errors │ ├── .gitignore │ ├── generated │ │ ├── .gitkeep │ │ ├── error-overview.rst │ │ └── error-overview.md │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── scripts │ │ ├── error-overview.tmpl.rst │ │ └── error-overview.tmpl.md │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── history │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── src │ │ └── index.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── logging │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── README.md │ ├── tsconfig.json │ ├── .mocharc.json │ ├── src │ │ └── index.ts │ └── .eslintrc.js ├── shell-api │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── src │ │ ├── mql-types.ts │ │ ├── mongosh-version.ts │ │ ├── deep-inspect │ │ │ └── ts-helpers.ts │ │ └── api.ts │ ├── tsconfig.json │ ├── .npmignore │ ├── .mocharc.json │ ├── README.md │ └── .eslintrc.js ├── arg-parser │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .npmignore │ ├── .mocharc.json │ ├── tsconfig.json │ └── .eslintrc.js ├── browser-repl │ ├── .gitignore │ ├── src │ │ ├── index.spec.tsx │ │ ├── iframe-runtime │ │ │ └── index.ts │ │ └── index.tsx │ ├── .prettierrc.json │ ├── .eslintignore │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── testing │ │ └── enzyme.ts │ ├── config │ │ └── webpack.config.test.js │ ├── .npmignore │ ├── .mocharc.json │ ├── .eslintrc.js │ └── tsconfig.json ├── testing │ ├── .gitignore │ ├── certificates │ │ ├── ca.serial │ │ ├── ca.db.attr │ │ └── client.bundle.pfx │ ├── .prettierrc │ ├── .prettierrc.json │ ├── .mocharc.json │ ├── tests-globalconfig.conf │ ├── tsconfig-lint.json │ ├── AUTHORS │ ├── src │ │ ├── chai.ts │ │ └── index.browser.ts │ ├── .eslintrc.json │ ├── .eslintrc.js │ ├── dummy.spec.ts │ └── tsconfig.json ├── cli-repl │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── test │ │ └── fixtures │ │ │ ├── load │ │ │ ├── throw.js │ │ │ ├── hello1.js │ │ │ ├── hello2.js │ │ │ ├── a.js │ │ │ ├── printisinteractive.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ └── insertintotest.js │ │ │ ├── nodescript.js │ │ │ └── fake-os-ca-provider.js │ ├── bin │ │ └── mongosh.js │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .npmignore │ ├── .mocharc.json │ └── src │ │ └── error-codes.ts ├── e2e-tests │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── test │ │ ├── fixtures │ │ │ ├── require-base │ │ │ │ ├── a.js │ │ │ │ └── node_modules │ │ │ │ │ ├── b │ │ │ │ │ └── index.js │ │ │ │ │ └── b-esm │ │ │ │ │ ├── index.mjs │ │ │ │ │ └── package.json │ │ │ ├── node-path │ │ │ │ └── c │ │ │ │ │ └── index.js │ │ │ ├── simple-console-log.js │ │ │ ├── custom-log-info.js │ │ │ ├── load │ │ │ │ ├── infinite-loop.js │ │ │ │ └── long-sleep.js │ │ │ └── curl.mjs │ │ └── util-helpers.ts │ ├── README.md │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ └── .npmignore ├── shell-evaluator │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── src │ │ └── index.ts │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── snippet-manager │ ├── .gitignore │ ├── .eslintignore │ ├── test │ │ └── fixtures │ │ │ ├── fakenpm5 │ │ │ ├── npm.bat │ │ │ └── npm │ │ │ ├── bson-4.4.0.tgz │ │ │ ├── npm-7.15.0.tgz │ │ │ ├── buffer-5.7.1.tgz │ │ │ ├── tarballed-example-file.tgz │ │ │ └── infinite-sleep.js │ ├── .prettierrc.json │ ├── src │ │ └── index.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── types │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .mocharc.json │ ├── README.md │ ├── tsconfig.json │ └── .eslintrc.js ├── browser-runtime-core │ ├── .gitignore │ ├── .prettierrc.json │ ├── .eslintignore │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ ├── .eslintrc.js │ └── src │ │ └── index.ts ├── browser-runtime-electron │ ├── .gitignore │ ├── .prettierrc.json │ ├── .eslintignore │ ├── src │ │ └── index.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── service-provider-core │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── src │ │ ├── platform.ts │ │ ├── shell-auth-options.ts │ │ ├── closable.ts │ │ └── all-fle-types.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── shell-bson │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .mocharc.json │ ├── src │ │ └── index.ts │ ├── AUTHORS │ ├── tsconfig.json │ └── .eslintrc.js ├── js-multiline-to-singleline │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── README.md │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ └── .eslintrc.js ├── service-provider-node-driver │ ├── .gitignore │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .mocharc.json │ ├── src │ │ └── index.ts │ └── .eslintrc.js ├── node-runtime-worker-thread │ ├── .gitignore │ ├── .eslintignore │ ├── README.md │ ├── .prettierrc.json │ ├── tests │ │ └── register-worker.js │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── tsconfig.json │ ├── .eslintrc.js │ └── .mocharc.json ├── async-rewriter2 │ ├── .eslintignore │ ├── .prettierrc.json │ ├── .gitignore │ ├── src │ │ └── index.ts │ ├── .prettierignore │ ├── tsconfig-lint.json │ ├── .npmignore │ ├── tsconfig.json │ ├── .mocharc.json │ ├── bin │ │ └── async-rewrite.js │ ├── .eslintrc.js │ └── benchmark │ │ └── index.ts ├── mongosh │ └── bin │ │ └── mongosh.js └── connectivity-tests │ ├── .mocharc.json │ ├── README.md │ └── test │ └── kerberos │ ├── Dockerfile.rocky8 │ ├── Dockerfile.rocky9 │ ├── Dockerfile.node20 │ ├── Dockerfile.ubuntu2004 │ ├── Dockerfile.ubuntu2204 │ └── krb5.conf ├── packaging ├── rpm-template │ ├── RPMS │ │ └── .keep │ ├── BUILD │ │ └── .keep │ ├── BUILDROOT │ │ └── .keep │ ├── SRPMS │ │ └── .keep │ └── SPECS │ │ ├── mongodb-mongosh-shared-openssl11.spec │ │ └── mongodb-mongosh-shared-openssl3.spec ├── msi-template │ ├── BUILD │ │ └── .keep │ └── resources │ │ ├── banner.bmp │ │ └── cover-installer.bmp ├── mongo.ico ├── deb-template │ └── DEBIAN │ │ └── control └── README ├── trace-expansions.yml ├── .github ├── CODEOWNERS └── ISSUE_TEMPLATE │ └── custom.md ├── config ├── .prettierrc.json ├── cta-config.json └── macos-entitlements.xml ├── .evergreen ├── .prettierrc.json ├── docker-config │ └── config.json ├── setup-ssh-key.sh ├── run-evergreen-release.sh ├── create-static-analysis-report.sh ├── build-variants │ ├── compile-build-variants.d.ts │ ├── e2e-tests-build-variants.d.ts │ └── unit-tests-build-variants.d.ts └── create-preload-script.sh ├── mongosh.gif ├── configs ├── tsconfig-mongosh │ ├── .prettierrc.json │ ├── .gitignore │ ├── README.md │ └── AUTHORS └── eslint-config-mongosh │ ├── .prettierrc.json │ ├── .gitignore │ ├── README.md │ ├── utils.js │ └── AUTHORS ├── .prettierignore ├── docs ├── cli-code-evaluation.png ├── cli-interrupt-events.png ├── cli-interrupt-handling.png ├── mongosh-architecture-jan2025.jam ├── mongosh-architecture-jan2025.png └── index.md ├── lerna.json ├── .husky └── pre-commit ├── .git-blame-ignore-revs ├── .mocharc.json ├── scripts ├── write-nodejs-dep.js ├── docker │ ├── run.sh │ └── README.md ├── dummy-browserslist.js ├── security-test-summary-template.md └── create-purls.js ├── licenses.json ├── .npmignore ├── .evergreen-nightly-driver.yml ├── .logs └── empty.xml ├── .snyk ├── .gitignore └── .nycrc /packages/i18n/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/java-shell/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/i18n/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packaging/rpm-template/RPMS/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/autocomplete/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ -------------------------------------------------------------------------------- /packages/build/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/editor/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/errors/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/errors/generated/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/history/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/logging/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/shell-api/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packaging/msi-template/BUILD/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packaging/rpm-template/BUILD/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packaging/rpm-template/BUILDROOT/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packaging/rpm-template/SRPMS/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/arg-parser/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/browser-repl/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/browser-repl/src/index.spec.tsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/testing/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | 3 | -------------------------------------------------------------------------------- /packages/cli-repl/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | dist/ 3 | -------------------------------------------------------------------------------- /packages/e2e-tests/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | dist/ 3 | -------------------------------------------------------------------------------- /packages/errors/generated/error-overview.rst: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/java-shell/cli/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/snippet-manager/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/types/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | dist/ 3 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/msi-template/BUILD/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/rpm-template/BUILD/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/rpm-template/RPMS/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/rpm-template/SRPMS/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/i18n/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/service-provider-core/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/shell-bson/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | dist/ 3 | -------------------------------------------------------------------------------- /packages/types/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /trace-expansions.yml: -------------------------------------------------------------------------------- 1 | release_version: "2.5.10" 2 | -------------------------------------------------------------------------------- /packages/arg-parser/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/autocomplete/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib/ -------------------------------------------------------------------------------- /packages/build/test/fixtures/rpm-template/BUILDROOT/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/editor/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/history/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /packages/shell-bson/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/bin/bar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo bar 3 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/bin/foo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo foo 3 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/snippet-manager/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/testing/certificates/ca.serial: -------------------------------------------------------------------------------- 1 | F349920F8B55BB16 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @mongodb-js/mongosh-developers 2 | -------------------------------------------------------------------------------- /config/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/build/examples/input.js: -------------------------------------------------------------------------------- 1 | console.info('Hello World!'); 2 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/README: -------------------------------------------------------------------------------- 1 | This is a very fake package 2 | -------------------------------------------------------------------------------- /packages/editor/src/index.ts: -------------------------------------------------------------------------------- 1 | export { Editor } from './editor'; 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/itcount.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packages/testing/certificates/ca.db.attr: -------------------------------------------------------------------------------- 1 | unique_subject = no 2 | -------------------------------------------------------------------------------- /.evergreen/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/build/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | coverage 4 | 5 | -------------------------------------------------------------------------------- /packages/build/src/compile/index.ts: -------------------------------------------------------------------------------- 1 | export * from './run-compile'; 2 | -------------------------------------------------------------------------------- /packages/build/src/local/index.ts: -------------------------------------------------------------------------------- 1 | export * from './trigger-release'; 2 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/LICENSE-bar: -------------------------------------------------------------------------------- 1 | Bar is licensed as an apple. 2 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/LICENSE-foo: -------------------------------------------------------------------------------- 1 | Foo is licensed as a banana. 2 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/bin/curator: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo Success 3 | -------------------------------------------------------------------------------- /packages/cli-repl/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bin 3 | lib 4 | dist 5 | -------------------------------------------------------------------------------- /packages/errors/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | local-test.js 3 | lib/ 4 | -------------------------------------------------------------------------------- /packages/i18n/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/drop.expected.txt: -------------------------------------------------------------------------------- 1 | [ ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/isClosed.expected.txt: -------------------------------------------------------------------------------- 1 | false -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/defaultDb.expected.txt: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/runCommand.expected.txt: -------------------------------------------------------------------------------- 1 | true -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/undefined.expected.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/service-provider-core/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/shell-api/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | local-test.js -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/fakenpm5/npm.bat: -------------------------------------------------------------------------------- 1 | @echo 5.4.0 2 | -------------------------------------------------------------------------------- /packages/testing/.prettierrc: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /mongosh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/mongosh.gif -------------------------------------------------------------------------------- /packages/build/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/cli-repl/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/throw.js: -------------------------------------------------------------------------------- 1 | throw new Error('uh oh'); 2 | -------------------------------------------------------------------------------- /packages/e2e-tests/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bin 3 | lib 4 | dist 5 | -------------------------------------------------------------------------------- /packages/e2e-tests/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/require-base/a.js: -------------------------------------------------------------------------------- 1 | module.exports = 'A'; 2 | -------------------------------------------------------------------------------- /packages/editor/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/errors/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/history/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/history/src/index.ts: -------------------------------------------------------------------------------- 1 | export { changeHistory } from './history'; 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countDocuments.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithLimit.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithQuery.expected.txt: -------------------------------------------------------------------------------- 1 | 2 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/aggregateExplain.expected.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/isClosedTrue.expected.txt: -------------------------------------------------------------------------------- 1 | true -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/defaultDb.js: -------------------------------------------------------------------------------- 1 | // command 2 | db 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/showDatabases.expected.txt: -------------------------------------------------------------------------------- 1 | "admin" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/version.expected.txt: -------------------------------------------------------------------------------- 1 | StringResult -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/DateNow.expected.txt: -------------------------------------------------------------------------------- 1 | LongResult -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/int.expected.txt: -------------------------------------------------------------------------------- 1 | IntResult: 42 -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/logging/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | local-test.js 3 | lib/ 4 | -------------------------------------------------------------------------------- /packages/logging/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | dist/ 3 | src/**/*.js -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /packages/shell-api/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/testing/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/types/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /config/cta-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./cta-config.schema.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/arg-parser/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | local-test.js 4 | -------------------------------------------------------------------------------- /packages/autocomplete/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/browser-repl/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/build/src/homebrew/index.ts: -------------------------------------------------------------------------------- 1 | export * from './publish-to-homebrew'; 2 | -------------------------------------------------------------------------------- /packages/cli-repl/bin/mongosh.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/run'); 3 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/node-path/c/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'C'; 2 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/simple-console-log.js: -------------------------------------------------------------------------------- 1 | console.log(233 + 377); 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/emptyCollection.expected.txt: -------------------------------------------------------------------------------- 1 | [ ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/stats.expected.txt: -------------------------------------------------------------------------------- 1 | "admin.coll" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/aggregateIsClosed.expected.txt: -------------------------------------------------------------------------------- 1 | false -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/bsonsize.expected.txt: -------------------------------------------------------------------------------- 1 | IntResult: 5 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/double.expected.txt: -------------------------------------------------------------------------------- 1 | DoubleResult: 0.1 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/float.expected.txt: -------------------------------------------------------------------------------- 1 | FloatResult: 0.5 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/null.expected.txt: -------------------------------------------------------------------------------- 1 | NullResult: null -------------------------------------------------------------------------------- /packages/shell-bson/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /configs/tsconfig-mongosh/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/browser-repl/src/iframe-runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './iframe-runtime'; 2 | -------------------------------------------------------------------------------- /packages/e2e-tests/README.md: -------------------------------------------------------------------------------- 1 | # @mongosh/e2e-tests 2 | 3 | E2E tests for mongosh 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithExplain.expected.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/estimatedDocumentCount.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/ref.expected.txt: -------------------------------------------------------------------------------- 1 | admin.collection 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/ref.js: -------------------------------------------------------------------------------- 1 | // command 2 | db.collection -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/totalIndexSize.expected.txt: -------------------------------------------------------------------------------- 1 | IntResult -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/dbHelp.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult 2 | "getMongo" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/emptyArray.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult: [ ] -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib/ 3 | dist/ 4 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/snippet-manager/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packaging/rpm-template/SPECS/mongodb-mongosh-shared-openssl11.spec: -------------------------------------------------------------------------------- 1 | mongodb-mongosh.spec -------------------------------------------------------------------------------- /packaging/rpm-template/SPECS/mongodb-mongosh-shared-openssl3.spec: -------------------------------------------------------------------------------- 1 | mongodb-mongosh.spec -------------------------------------------------------------------------------- /configs/eslint-config-mongosh/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndCount.expected.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/map.expected.txt: -------------------------------------------------------------------------------- 1 | [ "Vasya", "Petya", "Lyusya" ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/maxTimeMS.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getName.expected.txt: -------------------------------------------------------------------------------- 1 | switched to db admin 2 | admin -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/useDb.expected.txt: -------------------------------------------------------------------------------- 1 | switched to db admin 2 | admin -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/double.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | 0.1 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/emptyObject.expected.txt: -------------------------------------------------------------------------------- 1 | DocumentResult: { } -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/float.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | 0.5 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/int.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | 42 3 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/README.md: -------------------------------------------------------------------------------- 1 | # `@mongosh/node-runtime-worker-thread` 2 | -------------------------------------------------------------------------------- /packages/service-provider-core/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/snippet-manager/src/index.ts: -------------------------------------------------------------------------------- 1 | export { SnippetManager } from './snippet-manager'; 2 | -------------------------------------------------------------------------------- /packaging/mongo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packaging/mongo.ico -------------------------------------------------------------------------------- /packages/browser-repl/.eslintignore: -------------------------------------------------------------------------------- 1 | /lib/** 2 | /build/** 3 | /coverage/** 4 | !.eslintrc.js 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/estimatedDocumentCountWithMaxTime.expected.txt: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/cursorHelp.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult 2 | "addOption" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/max.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 1, "name": "Vasya" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/serverStatus.expected.txt: -------------------------------------------------------------------------------- 1 | DocumentResult 2 | StringResult -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/null.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | null 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/string.expected.txt: -------------------------------------------------------------------------------- 1 | StringResult: string literal -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/mongosh/bin/mongosh.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('@mongosh/cli-repl/lib/run'); 3 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@mongodb-js/prettier-config-devtools" 2 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | local-test.js 3 | src/runtime-support.out.nocov.ts 4 | -------------------------------------------------------------------------------- /packages/build/build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/build/build.png -------------------------------------------------------------------------------- /packages/build/src/evergreen/index.ts: -------------------------------------------------------------------------------- 1 | export * from './artifacts'; 2 | export * from './rest-api'; 3 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/require-base/node_modules/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'B'; 2 | 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findMap.expected.txt: -------------------------------------------------------------------------------- 1 | FindCursorResult: [ "Vasya" ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOne.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "v": "a" } -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/batchSize.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "a" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/noCursorTimeout.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/useDb.js: -------------------------------------------------------------------------------- 1 | // command 2 | use admin 3 | // command 4 | db 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/version.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | db.version() 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/DateNow.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | Date.now() 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Symbol.expected.txt: -------------------------------------------------------------------------------- 1 | SymbolResult: a 2 | SymbolResult: b -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/bsonsize.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | bsonsize({}) -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/emptyArray.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | [] 3 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/tests/register-worker.js: -------------------------------------------------------------------------------- 1 | global.Worker = require('web-worker'); 2 | -------------------------------------------------------------------------------- /packages/testing/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec": "./dummy.spec.ts", 3 | "exclude": "**/**" 4 | } 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.eslintignore: -------------------------------------------------------------------------------- 1 | /lib/** 2 | /build/** 3 | /coverage/** 4 | !.eslintrc.js 5 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.eslintignore: -------------------------------------------------------------------------------- 1 | /lib/** 2 | /build/** 3 | /coverage/** 4 | !.eslintrc.js 5 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/src/index.ts: -------------------------------------------------------------------------------- 1 | export { ElectronRuntime } from './electron-runtime'; 2 | -------------------------------------------------------------------------------- /packages/build/src/download-center/index.ts: -------------------------------------------------------------------------------- 1 | export * from './artifacts'; 2 | export * from './config'; 3 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/hello1.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | print('hello one'); 3 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/hello2.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | print('hello two'); 3 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/require-base/node_modules/b-esm/index.mjs: -------------------------------------------------------------------------------- 1 | export const value = 'B-ESM'; 2 | -------------------------------------------------------------------------------- /packages/i18n/src/index.ts: -------------------------------------------------------------------------------- 1 | import Translator from './translator'; 2 | export default new Translator(); 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/collectionHelp.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult 2 | "aggregate" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/isCapped.expected.txt: -------------------------------------------------------------------------------- 1 | false 2 | { "ok": 1 } 3 | true 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/mapArrowFunction.expected.txt: -------------------------------------------------------------------------------- 1 | [ "Vasya", "Petya", "Lyusya" ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/returnKey.expected.txt: -------------------------------------------------------------------------------- 1 | [ { }, { }, { } ] 2 | [ { }, { }, { } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getCollection.expected.txt: -------------------------------------------------------------------------------- 1 | StringResult: test.does not exist 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getName.js: -------------------------------------------------------------------------------- 1 | // command 2 | use admin 3 | // command 4 | db.getName() -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/undefined.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | undefined 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/unknownSymbol.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | unknown 3 | -------------------------------------------------------------------------------- /docs/cli-code-evaluation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/docs/cli-code-evaluation.png -------------------------------------------------------------------------------- /docs/cli-interrupt-events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/docs/cli-interrupt-events.png -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/help.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult 2 | ArrayResult 3 | "log" 4 | "log" 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/bool.expected.txt: -------------------------------------------------------------------------------- 1 | BooleanResult: true 2 | BooleanResult: true 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/string.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | "string literal" 3 | -------------------------------------------------------------------------------- /docs/cli-interrupt-handling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/docs/cli-interrupt-handling.png -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": ["configs/*", "packages/*", "scripts/docker"], 3 | "version": "independent" 4 | } 5 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/custom-log-info.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-undef 2 | log.info('Hi there'); 3 | -------------------------------------------------------------------------------- /packages/java-shell/.gitignore: -------------------------------------------------------------------------------- 1 | /src/main/resources/js/* 2 | /src/test/resources/URI.txt 3 | /build/ 4 | /.gradle/ 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/deleteMany.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "deletedCount": 5 } -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/deleteOne.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "deletedCount": 1 } -------------------------------------------------------------------------------- /packages/java-shell/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/async-rewriter2/src/index.ts: -------------------------------------------------------------------------------- 1 | import AsyncWriter from './async-writer-babel'; 2 | export default AsyncWriter; 3 | -------------------------------------------------------------------------------- /packages/autocomplete/src/node_modules/mongodb-ace-autocompleter/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'mongodb-ace-autocompleter'; 2 | -------------------------------------------------------------------------------- /packages/build/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/a.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | let variableFromA = 'yes from A'; 3 | print('Hi!') 4 | -------------------------------------------------------------------------------- /packages/connectivity-tests/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec": "../testing/dummy.spec.ts", 3 | "exclude": "**/**" 4 | } 5 | -------------------------------------------------------------------------------- /packages/i18n/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithProjection.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "a": 1 }, { "a": 2 }, { "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberInt.expected.txt: -------------------------------------------------------------------------------- 1 | IntResult: 24 2 | IntResult: 24 3 | IntResult: 24 4 | -------------------------------------------------------------------------------- /packages/service-provider-core/src/platform.ts: -------------------------------------------------------------------------------- 1 | export type ReplPlatform = 'CLI' | 'Browser' | 'Compass' | 'JavaShell'; 2 | -------------------------------------------------------------------------------- /packages/types/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /configs/tsconfig-mongosh/.gitignore: -------------------------------------------------------------------------------- 1 | .nyc_output 2 | node_modules 3 | package-lock.json 4 | coverage 5 | lib 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /docs/mongosh-architecture-jan2025.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/docs/mongosh-architecture-jan2025.jam -------------------------------------------------------------------------------- /docs/mongosh-architecture-jan2025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/docs/mongosh-architecture-jan2025.png -------------------------------------------------------------------------------- /packages/arg-parser/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/cli-repl/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/e2e-tests/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/load/infinite-loop.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-constant-condition 2 | while (true); 3 | -------------------------------------------------------------------------------- /packages/editor/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/errors/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/history/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/limit.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": 1 }, { "_id": , "a": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/min.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 2, "name": "Petya" }, { "_id": 3, "name": "Lyusya" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/next.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "name": "value1", "v": 1 } 2 | value1 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/skip.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": 2 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/dropDatabase.js: -------------------------------------------------------------------------------- 1 | // command 2 | use dbToDrop 3 | // command 4 | db.dropDatabase(); 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/runCommand.js: -------------------------------------------------------------------------------- 1 | // command extractProperty=ismaster 2 | db.runCommand('ismaster') 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/showDatabases.js: -------------------------------------------------------------------------------- 1 | // command getArrayItem=0 extractProperty=name 2 | show databases 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberLong.expected.txt: -------------------------------------------------------------------------------- 1 | LongResult: 24 2 | LongResult: 24 3 | LongResult: 24 4 | -------------------------------------------------------------------------------- /packages/logging/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/shell-api/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/shell-bson/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/testing/tests-globalconfig.conf: -------------------------------------------------------------------------------- 1 | # Default global configuration used by tests 2 | mongosh: 3 | logMaxFileCount: 100000 -------------------------------------------------------------------------------- /configs/eslint-config-mongosh/.gitignore: -------------------------------------------------------------------------------- 1 | .nyc_output 2 | node_modules 3 | package-lock.json 4 | coverage 5 | lib 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/autocomplete/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/browser-repl/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/build/src/git/index.ts: -------------------------------------------------------------------------------- 1 | export * from './changelog'; 2 | export * from './repository-status'; 3 | export * from './tags'; 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregate.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "G1", "total": 6 }, { "_id": "G2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/getIndexes.expected.1.txt: -------------------------------------------------------------------------------- 1 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_" } ] 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/dropDatabase.expected.txt: -------------------------------------------------------------------------------- 1 | switched to db dbToDrop 2 | { "ok": 1, "dropped": "dbToDrop" } -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getCollection.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | db.getCollection('does not exist'); 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/BSONSymbol.expected.txt: -------------------------------------------------------------------------------- 1 | SymbolResult: a 2 | SymbolResult: b 3 | SymbolResult: c 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/unknownSymbol.expected.txt: -------------------------------------------------------------------------------- 1 | java.lang.Exception: ReferenceError: unknown is not defined -------------------------------------------------------------------------------- /packages/shell-evaluator/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/snippet-manager/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/browser-repl/src/index.tsx: -------------------------------------------------------------------------------- 1 | export { Shell } from './components/shell'; 2 | export { IframeRuntime } from './iframe-runtime'; 3 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/printisinteractive.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | print(`isInteractive=${isInteractive()}`) 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/createIndexes.expected.txt: -------------------------------------------------------------------------------- 1 | [ "category_1", "title_1" ] 2 | "category_1" 3 | "title_1" -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollection.expected.txt: -------------------------------------------------------------------------------- 1 | { "ok": 1 } 2 | [ ] 3 | [ { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/explain.expected.txt: -------------------------------------------------------------------------------- 1 | "admin.coll" 2 | "admin.coll" 3 | "admin.coll" 4 | true 5 | false 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/projection.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "name": "Vasya" }, { "name": "Petya" }, { "name": "Lyusya" } ] -------------------------------------------------------------------------------- /.evergreen/docker-config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "auths": { 3 | "https://index.docker.io/v1/": {} 4 | }, 5 | "credsStore": "from-env" 6 | } 7 | -------------------------------------------------------------------------------- /configs/tsconfig-mongosh/README.md: -------------------------------------------------------------------------------- 1 | # @mongodb-js/tsconfig-devtools 2 | 3 | > Shared TypeScript base configurations for Mongosh packages. 4 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/build/examples/fake-curator.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/build/examples/fake-curator.tar.gz -------------------------------------------------------------------------------- /packages/build/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './spawn-sync'; 2 | export * from './user-input'; 3 | export * from './with-retries'; 4 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/manpages.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/build/test/fixtures/manpages.tar.gz -------------------------------------------------------------------------------- /packages/connectivity-tests/README.md: -------------------------------------------------------------------------------- 1 | # `connectivity-tests` 2 | 3 | Contains some of the connectivity tests that don’t run everywhere. 4 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/require-base/node_modules/b-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "main": "index.mjs" 4 | } 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateAllowDiskUse.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "11", "total": 6 }, { "_id": "2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithMaxTime.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "11", "total": 6 }, { "_id": "2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithQuery.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": 2 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/emptyObject.js: -------------------------------------------------------------------------------- 1 | // before 2 | const emptyO = {}; 3 | // command checkResultClass 4 | emptyO 5 | -------------------------------------------------------------------------------- /packages/service-provider-core/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packaging/msi-template/resources/banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packaging/msi-template/resources/banner.bmp -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/b.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | load(__dirname + '/a.js'); 3 | let variableFromB = variableFromA + ' from B'; 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithBatchSize.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "11", "total": 6 }, { "_id": "2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithCollation.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "2", "total": 2 }, { "_id": "11", "total": 6 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithReadConcern.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "G1", "total": 6 }, { "_id": "G2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithoutArray.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": "G1", "total": 6 }, { "_id": "G2", "total": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndReplace.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "a": 1 } 2 | [ { "_id": , "a": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/getIndexes.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_", "ns": "admin.coll" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollectionDropTarget.expected.txt: -------------------------------------------------------------------------------- 1 | { "ok": 1 } 2 | [ ] 3 | [ { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/runCommandUserInfo.js: -------------------------------------------------------------------------------- 1 | // before 2 | use admin 3 | // command 4 | db.runCommand({usersInfo: 'admin'}); 5 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/fakenpm5/npm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Pretend to always run as --version for an old npm version 3 | echo 5.4.0 4 | -------------------------------------------------------------------------------- /packages/testing/certificates/client.bundle.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/testing/certificates/client.bundle.pfx -------------------------------------------------------------------------------- /packages/testing/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.lint.json", 3 | "include": ["src/**/*"] 4 | } 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | # listings staged files only 2 | fileList=$(git diff --diff-filter=AM --cached --name-only) 3 | 4 | npm run precommit $fileList 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/array.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult: [ 1, 2, "hello \n world" ] 2 | ArrayResult: [ 1, 2, "hello \n world" ] 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/object.expected.txt: -------------------------------------------------------------------------------- 1 | DocumentResult: { "key": "hello \n world", "number": 1, "innerObject": { "a": 2 } } -------------------------------------------------------------------------------- /packages/build/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/editor/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/i18n/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWrongWriteConcern2.expected.txt: -------------------------------------------------------------------------------- 1 | java.lang.IllegalArgumentException: state should be: w >= 0 2 | [ ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/dbHelp.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | db.help() 3 | // command getArrayItem=0 extractProperty=name 4 | db.help() -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib 2 | **/dist 3 | **/node_modules 4 | **/test/fixtures 5 | **/*.nocov* 6 | **/*.wxs 7 | **/.sbom 8 | -------------------------------------------------------------------------------- /packages/types/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packaging/msi-template/resources/cover-installer.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packaging/msi-template/resources/cover-installer.bmp -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # prettier adoption 2 | 7e9ecd99d852e5e5f2a659c4a12b090c370b6a6c 3 | # eslintrc overhaul 4 | 0f28698459e1c8216df769745170a3a46d3def62 5 | -------------------------------------------------------------------------------- /packages/arg-parser/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/nodescript.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert'); 2 | assert.strictEqual(typeof print, 'undefined'); 3 | console.log('works!'); 4 | -------------------------------------------------------------------------------- /packages/cli-repl/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/e2e-tests/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/history/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/java-shell/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/comment.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 1, "name": "Vasya" }, { "_id": 2, "name": "Petya" }, { "_id": 3, "name": "Lyusya" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/hint.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 1, "name": "Vasya" }, { "_id": 2, "name": "Petya" }, { "_id": 3, "name": "Lyusya" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/sort.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 3, "name": "Lyusya" }, { "_id": 2, "name": "Petya" }, { "_id": 1, "name": "Vasya" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/showCollections.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "insertedId": } 2 | [ { "name": "coll", "badge": "" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Symbol-ignored.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | Symbol('a') 3 | // command checkResultClass 4 | new Symbol('b') -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/long.expected.txt: -------------------------------------------------------------------------------- 1 | LongResult: 2147483649 2 | DoubleResult: 1281104301025214460 3 | LongResult: 1281104301025214467 -------------------------------------------------------------------------------- /packages/logging/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/shell-bson/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/bson-4.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/snippet-manager/test/fixtures/bson-4.4.0.tgz -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/npm-7.15.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/snippet-manager/test/fixtures/npm-7.15.0.tgz -------------------------------------------------------------------------------- /packages/autocomplete/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/build/src/packaging/package/index.ts: -------------------------------------------------------------------------------- 1 | export * from './package-information'; 2 | export * from './create-package'; 3 | export * from './get-package-file'; 4 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/fake-os-ca-provider.js: -------------------------------------------------------------------------------- 1 | let fn; 2 | module.exports = (...args) => fn(...args); 3 | module.exports.setFn = (newFn) => { fn = newFn; }; 4 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/util-helpers.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number): Promise { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/dropIndexes.expected.1.txt: -------------------------------------------------------------------------------- 1 | { "nIndexesWas": 3, "ok": 1 } 2 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_" } ] 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/emptyCollection.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.emptyCollection.deleteMany({}); 3 | // command 4 | db.emptyCollection.find(); 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndDelete.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "a": 1, "text": "to delete" } 2 | [ { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndReplaceWithReturnDocument.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "a": 2 } 2 | [ { "_id": , "a": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/withPeriod.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": 1 }, { "_id": , "a": 2 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/forEach.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 1, "name": "Vasya" }, { "_id": 2, "name": "Petya" }, { "_id": 3, "name": "Lyusya" } ] 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/serverStatus.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | db.serverStatus() 3 | // command dontCheckValue 4 | db.serverStatus().version -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MaxKey.expected.txt: -------------------------------------------------------------------------------- 1 | MaxKeyResult: {"$maxKey": 1} 2 | MaxKeyResult: {"$maxKey": 1} 3 | MaxKeyResult: {"$maxKey": 1} 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MinKey.expected.txt: -------------------------------------------------------------------------------- 1 | MinKeyResult: {"$minKey": 1} 2 | MinKeyResult: {"$minKey": 1} 3 | MinKeyResult: {"$minKey": 1} 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberDecimal.expected.txt: -------------------------------------------------------------------------------- 1 | Decimal128Result: {"$numberDecimal": "24"} 2 | Decimal128Result: {"$numberDecimal": "24"} 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/long.expected.1.txt: -------------------------------------------------------------------------------- 1 | LongResult: 2147483649 2 | DoubleResult: 1281104301025214500 3 | LongResult: 1281104301025214467 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/long.expected.2.txt: -------------------------------------------------------------------------------- 1 | LongResult: 2147483649 2 | LongResult: 1281104301025214464 3 | LongResult: 1281104301025214467 4 | -------------------------------------------------------------------------------- /packages/shell-evaluator/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/buffer-5.7.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/snippet-manager/test/fixtures/buffer-5.7.1.tgz -------------------------------------------------------------------------------- /packages/snippet-manager/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec": ["packages/testing/dummy.spec.ts"], 3 | "exclude": ["node_modules/**"], 4 | "node-option": ["no-experimental-strip-types=true"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/c.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const start = new Date().getTime(); 3 | sleep(100); 4 | const diff = new Date().getTime() - start; 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithUnknownOption.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.mongosh.result.CommandException: unrecognized count options field: unknown -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWriteConcern.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "insertedId": } 2 | [ { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/service-provider-core/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /.evergreen/setup-ssh-key.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -e 4 | set +x 5 | echo "${__project_aws_ssh_key_value}" > ~/.ssh/mcipacker.pem 6 | chmod 0600 ~/.ssh/mcipacker.pem -------------------------------------------------------------------------------- /packages/browser-runtime-electron/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/load/long-sleep.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | console.log('Long sleep'); 3 | (async() => { 4 | await sleep(1_000_000); 5 | })(); 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/collation.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "a" }, { "_id": , "a": "A" }, { "_id": , "a": "\u00E1" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/readPref.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "a" }, { "_id": , "a": "A" }, { "_id": , "a": "\u00E1" } ] 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/toArray.expected.txt: -------------------------------------------------------------------------------- 1 | ArrayResult: [ { "_id": 1, "name": "Vasya" }, { "_id": 2, "name": "Petya" }, { "_id": 3, "name": "Lyusya" } ] -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/collectionHelp.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | db.coll.help() 3 | // command getArrayItem=0 extractProperty=name 4 | db.coll.help() -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/find.expected.txt: -------------------------------------------------------------------------------- 1 | FindCursorResult: [ { "_id": , "key": "value", "array": [ 1, 2, 3, { "another_object": " .$# " } ] } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWrongWriteConcern.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.mongosh.result.CommandException: unrecognized write concern field: error 2 | [ ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/DBRef.expected.txt: -------------------------------------------------------------------------------- 1 | DBRefResult: { "$ref" : "namespace", "$id" : "oid" } 2 | DBRefResult: { "$ref" : "namespace", "$id" : "oid" } 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/object.js: -------------------------------------------------------------------------------- 1 | // before 2 | const o = {key: "hello \n world", number: 1, innerObject: {a: 2}}; 3 | // command checkResultClass 4 | o 5 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /scripts/write-nodejs-dep.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | console.log(JSON.stringify([{ 4 | name: '.node.js', 5 | version: process.env.NODE_JS_VERSION 6 | }])); 7 | -------------------------------------------------------------------------------- /packages/build/src/npm-packages/index.ts: -------------------------------------------------------------------------------- 1 | export { PackageBumper } from './bump'; 2 | export { PackagePublisher } from './publish'; 3 | export { PackagePublisherConfig } from './types'; 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/count.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "0": "DeprecationWarning: Collection.count() is deprecated. Use countDocuments or estimatedDocumentCount." } ] 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/dropIndexes.expected.txt: -------------------------------------------------------------------------------- 1 | { "nIndexesWas": 3, "ok": 1 } 2 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_", "ns": "admin.coll" } ] 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithRegexp.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "cat1" }, { "_id": , "a": "cat2" }, { "_id": , "a": "cat3" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/replaceOne.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=1, modifiedCount=1, upsertedId=null} 2 | [ { "_id": , "a": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/cursorHelp.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | db.coll.find().help() 3 | // command getArrayItem=0 extractProperty=name 4 | db.coll.find().help() -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/readConcern.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": 1 } ] 2 | java.lang.IllegalArgumentException: 'unknown' is not a valid readConcernLevel -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Code.expected.txt: -------------------------------------------------------------------------------- 1 | CodeWithScopeResult: {"$code": "code"} 2 | CodeResult: {"$code": "code"} 3 | CodeWithScopeResult: {"$code": "code"} 4 | -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/tarballed-example-file.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-js/mongosh/HEAD/packages/snippet-manager/test/fixtures/tarballed-example-file.tgz -------------------------------------------------------------------------------- /configs/eslint-config-mongosh/README.md: -------------------------------------------------------------------------------- 1 | # @mongodb-js/eslint-config-mongosh 2 | 3 | > Shared [eslint][eslint] configuration for Mongosh packages. 4 | 5 | [eslint]: https://eslint.org/ 6 | -------------------------------------------------------------------------------- /packages/errors/generated/error-overview.md: -------------------------------------------------------------------------------- 1 | # mongosh Error Codes Overview 2 | 3 | To quickly find an error by its code, search for the code in this overview. 4 | 5 | ## Table of Contents 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Timestamp.expected.txt: -------------------------------------------------------------------------------- 1 | BSONTimestampResult: {"$timestamp": {"t": 100, "i": 0}} 2 | BSONTimestampResult: {"$timestamp": {"t": 100, "i": 0}} 3 | -------------------------------------------------------------------------------- /packages/testing/AUTHORS: -------------------------------------------------------------------------------- 1 | Gagik Amaryan 2 | mongodb-devtools-bot[bot] <189715634+mongodb-devtools-bot[bot]@users.noreply.github.com> 3 | Anna Henningsen 4 | -------------------------------------------------------------------------------- /packages/errors/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["./src/**/*", "./scripts/**/*", "./test/**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/dropIndex.expected.1.txt: -------------------------------------------------------------------------------- 1 | { "nIndexesWas": 3, "ok": 1 } 2 | { "nIndexesWas": 2, "ok": 1 } 3 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_" } ] 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOneUpsert.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=0, modifiedCount=0, upsertedId=null} 2 | [ { "_id": , "a": 1, "b": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/isClosedTrue.js: -------------------------------------------------------------------------------- 1 | // before 2 | const cursor = db.coll.find(); 3 | cursor.close() 4 | // command 5 | cursor.isClosed(); 6 | // clear 7 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/tailable.expected.1.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoQueryException: Command failed with error 2 (BadValue): 'error processing query: ns=admin.collTree: $and 2 | -------------------------------------------------------------------------------- /licenses.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignoredOrgs": ["@mongodb-js", "@leafygreen-ui"], 3 | "doNotValidatePackages": ["argparse@2.0.1"], 4 | "licenseOverrides": { 5 | "cli-table@0.3.11": "MIT" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/browser-repl/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["./src/**/*", "./test/**/*", "./config/**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/bulkWriteException.expected.txt: -------------------------------------------------------------------------------- 1 | java.lang.IllegalArgumentException: Unknown bulk write operation Document{{unknown=Document{{document=Document{{a=1}}}}}} -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/distinct.expected.txt: -------------------------------------------------------------------------------- 1 | [ 1, 2, 3 ] 2 | [ "hello", "world" ] 3 | [ 1, 2, "hello" ] 4 | [ 1 ] 5 | [ { "a": 1 }, { } ] 6 | [ "hello" ] 7 | [ "caf\u00E9" ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/drop.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.drop(); 6 | // command 7 | db.coll.find(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithRegexpCaseInsensitive.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "cat1" }, { "_id": , "a": "cat2" }, { "_id": , "a": "cat3" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/createCollectionWithTimeseries.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "insertedId": } 2 | { "timestamp": {"$date": {"$numberLong": "1662681600000"}} } -------------------------------------------------------------------------------- /packages/shell-api/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["./src/**/*", "./scripts/**/*", "./test/**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/async-rewriter2/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["./src/**/*", "./benchmark/**/*", "./test/**/*"], 4 | "exclude": ["node_modules", "dist", "lib"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndUpdate.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "a": 1 } 2 | [ { "_id": , "a": 6 }, { "_id": , "a": 2 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertMany.expected.txt: -------------------------------------------------------------------------------- 1 | { "acknowledged": true, "insertedIds": [ ] } 2 | [ { "_id": , "a": 1 }, { "_id": , "a": 2, "array": [ 42, 43 ] } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/maxTimeMS.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({}); 4 | // command 5 | db.coll.find().maxTimeMS(100); 6 | // clear 7 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/tsconfig-lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "./src/**/*", 5 | "./test/**/*" 6 | ], 7 | "exclude": ["node_modules", "dist", "lib"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/snippet-manager/test/fixtures/infinite-sleep.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const fs = require('fs'); 3 | fs.writeFileSync('infinite-sleep.pid', String(process.pid)); 4 | setInterval(() => {}, 1000); 5 | -------------------------------------------------------------------------------- /packages/types/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["ts-node/register"], 3 | "timeout": 15000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/README.md: -------------------------------------------------------------------------------- 1 | # `@mongosh/types` 2 | 3 | > TODO: description 4 | 5 | ## Usage 6 | 7 | ``` 8 | const types = require('@mongosh/types'); 9 | 10 | // TODO: DEMONSTRATE API 11 | ``` 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/getIndexes.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.getIndexes(); 6 | // clear 7 | db.coll.drop(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/noCursorTimeout.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({}); 4 | // command 5 | db.coll.find().noCursorTimeout() 6 | // clear 7 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/shell-bson/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["ts-node/register"], 3 | "timeout": 15000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/browser-repl/testing/enzyme.ts: -------------------------------------------------------------------------------- 1 | import { configure } from 'enzyme'; 2 | import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; 3 | configure({ adapter: new Adapter() }); 4 | 5 | export * from 'enzyme'; 6 | -------------------------------------------------------------------------------- /packages/build/src/packaging/index.ts: -------------------------------------------------------------------------------- 1 | export * from './run-package'; 2 | 3 | export { 4 | getPackageFile, 5 | PackageFile, 6 | PackageInformation, 7 | PackageInformationProvider, 8 | } from './package'; 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/bulkWriteException.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.bulkWrite([{unknown: {document: {a: 1}}}]); 5 | // clear 6 | db.coll.drop(); 7 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/dropIndex.expected.txt: -------------------------------------------------------------------------------- 1 | { "nIndexesWas": 3, "ok": 1 } 2 | { "nIndexesWas": 2, "ok": 1 } 3 | [ { "v": 2, "key": { "_id": 1 }, "name": "_id_", "ns": "admin.coll" } ] 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/stats.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command extractProperty=ns 5 | db.coll.stats() 6 | // clear 7 | db.coll.drop(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/createView.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": 1, "department": "A", "management": 3 }, { "_id": 2, "department": "B", "management": 2 }, { "_id": 3, "department": "A", "management": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/showCollections.js: -------------------------------------------------------------------------------- 1 | // before 2 | use test_show_collections; 3 | // command 4 | db.coll.insertOne({}); 5 | // command 6 | show collections; 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/testing/src/chai.ts: -------------------------------------------------------------------------------- 1 | import * as chai from 'chai'; 2 | import { expect } from 'chai'; 3 | import sinonChai from 'sinon-chai'; 4 | chai.use(sinonChai); 5 | 6 | export default chai; 7 | export { expect }; 8 | -------------------------------------------------------------------------------- /packages/editor/README.md: -------------------------------------------------------------------------------- 1 | # `@mongosh/editor` 2 | 3 | Package for [MongoDB Shell](https://github.com/mongodb-js/mongosh). 4 | 5 | ### Installation 6 | 7 | ```shell 8 | npm install -S @mongosh/editor 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/main/kotlin/com/mongodb/mongosh/result/CommandException.kt: -------------------------------------------------------------------------------- 1 | package com.mongodb.mongosh.result 2 | 3 | 4 | class CommandException(val errmsg: String, val codeName: String) : Exception(errmsg) 5 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndModify.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "v": "a", "number": 1 } 2 | [ { "_id": , "v": "a", "number": 2 }, { "_id": , "v": "b", "number": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/replaceOneUpsert.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=0, modifiedCount=0, upsertedId=null} 2 | [ { "_id": , "a": 1 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/tailable.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoQueryException: Query failed with error code 2 with name 'BadValue' and error message 'error processing query: ns=admin.collTree: $and 2 | -------------------------------------------------------------------------------- /packages/shell-bson/src/index.ts: -------------------------------------------------------------------------------- 1 | export type * from './bson-export'; 2 | export { constructShellBson, type ShellBson } from './shell-bson'; 3 | export { makePrintableBson, makeBsonStringifiers } from './printable-bson'; 4 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndModifyWithNew.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "v": "a", "number": 2 } 2 | [ { "_id": , "v": "a", "number": 2 }, { "_id": , "v": "b", "number": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndUpdateWithReturnDocument.expected.txt: -------------------------------------------------------------------------------- 1 | { "_id": , "a": 6 } 2 | [ { "_id": , "a": 6 }, { "_id": , "a": 2 }, { "_id": , "a": 3 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/long.js: -------------------------------------------------------------------------------- 1 | // command checkResultClass 2 | 2147483649 3 | // command checkResultClass 4 | 1281104301025214467 5 | // command checkResultClass 6 | new NumberLong("1281104301025214467") -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOne.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertMany([{v: "a"}, {v: "a"}]); 4 | // command 5 | db.coll.findOne({"v": "a"}); 6 | // clear 7 | db.coll.drop(); 8 | -------------------------------------------------------------------------------- /packages/service-provider-core/src/shell-auth-options.ts: -------------------------------------------------------------------------------- 1 | export default interface ShellAuthOptions { 2 | user: string; 3 | pwd: string; 4 | mechanism?: string; 5 | digestPassword?: boolean; 6 | authDb?: string; 7 | } 8 | -------------------------------------------------------------------------------- /packages/java-shell/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | maven { url 'https://plugins.gradle.org/m2/' } 5 | } 6 | } 7 | rootProject.name = 'java-shell' 8 | include 'cli' 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/createCollection.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoWriteException: Write operation error on server %mongohostport%. Write error: WriteError{code=121, message='Document failed validation', details={}}. -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/ObjectId.expected.txt: -------------------------------------------------------------------------------- 1 | ObjectIdResult: 5ebaf064121756574a9767cf 2 | ObjectIdResult: 5ebaf064121756574a9767cf 3 | ObjectIdResult: 4 | ObjectIdResult: 5ebaf064121756574a9767cf 5 | -------------------------------------------------------------------------------- /packages/shell-api/src/mql-types.ts: -------------------------------------------------------------------------------- 1 | import type { Document } from '@mongosh/service-provider-core'; 2 | 3 | export type MQLQuery = Document; 4 | 5 | export type MQLPipeline = Document[]; 6 | 7 | export type MQLDocument = Document; 8 | -------------------------------------------------------------------------------- /packages/i18n/src/locales/de_DE.ts: -------------------------------------------------------------------------------- 1 | import type Catalog from '../catalog'; 2 | import enUs from './en_US'; 3 | 4 | /** 5 | * DE german translations. 6 | */ 7 | const translations: Catalog = { ...enUs }; 8 | export default translations; 9 | -------------------------------------------------------------------------------- /packages/browser-repl/config/webpack.config.test.js: -------------------------------------------------------------------------------- 1 | const webpackConfigBase = require('./webpack.config.base'); 2 | 3 | process.env.NODE_ENV = 'test'; 4 | 5 | module.exports = { 6 | ...webpackConfigBase, 7 | mode: 'development', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/cli-repl/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/e2e-tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertMany.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.insertMany([{a: 1}, {a: 2, array: [42, 43]}]); 5 | // command 6 | db.coll.find(); 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/UUID.expected.txt: -------------------------------------------------------------------------------- 1 | UUIDResult: 5220b418-8f7d-4cd9-bd27-35b6f8d990c5 2 | UUIDResult: 5220b418-8f7d-4cd9-bd27-35b6f8d990c5 3 | UUIDResult: 4 | UUIDResult: 5220b418-8f7d-4cd9-bd27-35b6f8d990c5 5 | -------------------------------------------------------------------------------- /packages/shell-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/testing/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/eslint-config-mongosh", 3 | "parserOptions": { 4 | "project": ["./tsconfig-lint.json"] 5 | }, 6 | "rules": { 7 | "mocha/no-exports": "off" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/help.js: -------------------------------------------------------------------------------- 1 | // command dontCheckValue 2 | help 3 | // command dontCheckValue 4 | help() 5 | // command getArrayItem=0 extractProperty=name 6 | help 7 | // command getArrayItem=0 extractProperty=name 8 | help() 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/bool.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: true}); 3 | // command checkResultClass 4 | true 5 | // command checkResultClass 6 | db.coll.find().toArray()[0].v; 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/shell-evaluator/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ShellResult, 3 | ShellEvaluator, 4 | EvaluationListener, 5 | } from './shell-evaluator'; 6 | 7 | export { ShellResult, ShellEvaluator, EvaluationListener }; 8 | export default ShellEvaluator; 9 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/createIndex.expected.txt: -------------------------------------------------------------------------------- 1 | category_1 2 | "category_1" 3 | { "nIndexesWas": 2, "ok": 1 } 4 | category_1 5 | "de" 6 | { "nIndexesWas": 2, "ok": 1 } 7 | category_text_v_text 8 | { "category": 10, "v": 5 } 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findMap.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({name: "Vasya"}); 4 | // command checkResultClass 5 | db.coll.find().map(d => d.name).batchSize(1); 6 | // clear 7 | db.coll.drop(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateManyPipeline.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=3, modifiedCount=3, upsertedId=null} 2 | [ { "_id": , "b": 1 }, { "_id": , "b": 1 }, { "_id": , "b": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOne.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=1, modifiedCount=1, upsertedId=null} 2 | [ { "_id": , "a": 1, "b": 1 }, { "_id": , "a": 1 }, { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOnePipeline.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=1, modifiedCount=1, upsertedId=null} 2 | [ { "_id": , "b": 1 }, { "_id": , "a": 1 }, { "_id": , "a": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOneUpsert.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.updateOne({a: 1}, {$set: {b: 1}}, {upsert: true}); 5 | // command 6 | db.coll.find(); 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getCollectionInfos.expected.1.txt: -------------------------------------------------------------------------------- 1 | [ { "name": "testCollection1", "type": "collection", "options": { }, "info": { "readOnly": false, "uuid": }, "idIndex": { "v": 2, "key": { "_id": 1 }, "name": "_id_" } } ] 2 | -------------------------------------------------------------------------------- /packages/logging/README.md: -------------------------------------------------------------------------------- 1 | # `@mongosh/logging` 2 | 3 | Package for [MongoDB Shell](mongosh). 4 | 5 | ### Installation 6 | 7 | ```shell 8 | npm install -S @mongosh/logging 9 | ``` 10 | 11 | [mongosh]: https://github.com/mongodb-js/mongosh 12 | -------------------------------------------------------------------------------- /packages/service-provider-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/errors/scripts/error-overview.tmpl.rst: -------------------------------------------------------------------------------- 1 | {{#each packages}} 2 | {{package}} 3 | {{packageHeadlineSeparator}} 4 | 5 | {{#each errors}} 6 | ``{{code}}`` 7 | {{codeHeadlineSeparator}} 8 | 9 | {{{documentation}}} 10 | 11 | {{/each}} 12 | {{/each}} -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWrongWriteConcern.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.insertOne({a: 1}, {writeConcern: {error: 1}}); 5 | // command 6 | db.coll.find(); 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWrongWriteConcern2.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.insertOne({a: 1}, {writeConcern: {w: -1}}); 5 | // command 6 | db.coll.find(); 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/limit.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.find().limit(2); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | config/ 17 | -------------------------------------------------------------------------------- /packages/i18n/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/readConcern.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.drop(); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.find().readConcern('local'); 6 | // command 7 | db.coll.find().readConcern('unknown'); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/service-provider-node-driver/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["./src/**/*.spec.*"] 8 | } 9 | -------------------------------------------------------------------------------- /configs/eslint-config-mongosh/utils.js: -------------------------------------------------------------------------------- 1 | exports.fixCygwinPath = function (filepath) { 2 | // see https://github.com/nodejs/node/issues/34866 3 | // similar to what we work around in compass' CI 4 | return filepath.replace(/^Z:\\data\\mci/, 'C:\\data\\mci'); 5 | }; 6 | -------------------------------------------------------------------------------- /packages/build/src/config/index.ts: -------------------------------------------------------------------------------- 1 | export * from './build-variant'; 2 | export * from './config'; 3 | export * from './get-release-version-from-tag'; 4 | export * from './platform'; 5 | export * from './should-do-public-release'; 6 | export * from './redact-config'; 7 | -------------------------------------------------------------------------------- /packages/cli-repl/test/fixtures/load/insertintotest.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | insertTestCollection = db.getSiblingDB('test').getCollection('insertTest' + ((Math.random() * 100000) | 0)); 3 | print('Inserted:', insertTestCollection.insertOne({}).insertedId) 4 | -------------------------------------------------------------------------------- /packages/e2e-tests/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["ts-node/register", "../../scripts/import-expansions.js"], 3 | "timeout": 15000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./test/*.spec.ts"], 6 | "color": true 7 | } 8 | -------------------------------------------------------------------------------- /packages/editor/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/history/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/count.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.count(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/find.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({key: "value", array: [1, 2, 3, {another_object: " .$# "}]}); 4 | // command checkResultClass 5 | db.coll.find(); 6 | // clear 7 | db.coll.drop(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/replaceOne.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.replaceOne({a: 1}, {a: 2}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateMany.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=3, modifiedCount=3, upsertedId=null} 2 | [ { "_id": , "a": 1, "b": 1 }, { "_id": , "a": 1, "b": 1 }, { "_id": , "a": 1, "b": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/runCommandUserInfo.expected.txt: -------------------------------------------------------------------------------- 1 | { "users": [ { "_id": "admin.admin", "userId": , "user": "admin", "db": "admin", "roles": [ { "role": "root", "db": "admin" } ], "mechanisms": [ "SCRAM-SHA-1", "SCRAM-SHA-256" ] } ], "ok": 1 } -------------------------------------------------------------------------------- /packages/shell-api/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /.evergreen/run-evergreen-release.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -e 3 | 4 | echo "//registry.npmjs.org/:_authToken=${devtoolsbot_npm_token}" >.npmrc 5 | set -x 6 | export NODE_JS_VERSION=${node_js_version} 7 | source .evergreen/setup-env.sh 8 | npm run evergreen-release $@ 9 | -------------------------------------------------------------------------------- /packages/arg-parser/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/browser-repl/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/Dockerfile.rocky8: -------------------------------------------------------------------------------- 1 | FROM rockylinux:8 2 | RUN yum repolist 3 | RUN yum install -y krb5-workstation krb5-libs 4 | 5 | COPY krb5.conf /etc/krb5.conf 6 | COPY kerberos-run.sh /tmp/kerberos-run.sh 7 | 8 | CMD [ "/tmp/kerberos-run.sh" ] 9 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/Dockerfile.rocky9: -------------------------------------------------------------------------------- 1 | FROM rockylinux:9 2 | RUN yum repolist 3 | RUN yum install -y krb5-workstation krb5-libs 4 | 5 | COPY krb5.conf /etc/krb5.conf 6 | COPY kerberos-run.sh /tmp/kerberos-run.sh 7 | 8 | CMD [ "/tmp/kerberos-run.sh" ] 9 | -------------------------------------------------------------------------------- /packages/editor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/errors/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/i18n/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/skip.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.find().skip(1); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MD5.expected.txt: -------------------------------------------------------------------------------- 1 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "05"}} 2 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "05"}} 3 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "05"}} 4 | -------------------------------------------------------------------------------- /packages/shell-bson/AUTHORS: -------------------------------------------------------------------------------- 1 | Anna Henningsen 2 | mongodb-devtools-bot[bot] <189715634+mongodb-devtools-bot[bot]@users.noreply.github.com> 3 | Ubuntu 4 | Gagik Amaryan 5 | Rhys Howell 6 | -------------------------------------------------------------------------------- /packages/types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /.evergreen-nightly-driver.yml: -------------------------------------------------------------------------------- 1 | # https://github.com/evergreen-ci/evergreen/blob/main/docs/Project-Configuration/Parameterized-Builds.md#project-config 2 | parameters: 3 | - key: mongodb_driver_version_override 4 | value: nightly 5 | 6 | include: 7 | - filename: .evergreen.yml -------------------------------------------------------------------------------- /packages/async-rewriter2/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/build/src/config/platform.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Platform enum. 3 | * 4 | * Different from 'BuildVariant': platform is extracted from os.platform() and 5 | * build variant is the host evergreen is building on. 6 | */ 7 | export type Platform = 'win32' | 'darwin' | 'linux'; 8 | -------------------------------------------------------------------------------- /packages/cli-repl/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | dist/ 17 | -------------------------------------------------------------------------------- /packages/history/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/java-shell/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndReplace.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.findOneAndReplace({a: 1}, {a: 2}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertOneWriteConcern.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.insertOne({a: 1}, {writeConcern: {w: 1, j: true, wtimeout: 1000}}); 5 | // command 6 | db.coll.find(); 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getCollectionInfos.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "name": "testCollection1", "type": "collection", "options": { }, "info": { "readOnly": false, "uuid": }, "idIndex": { "v": 2, "key": { "_id": 1 }, "name": "_id_", "ns": "test.testCollection1" } } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/db/getCollectionInfos.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.testCollection1.deleteMany({}); 3 | db.testCollection1.insertOne({a: 1}); 4 | // command 5 | db.getCollectionInfos({name: {$regex: "testCollection.*"}}); 6 | // clear 7 | db.testCollection1.drop(); 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/HexData.expected.txt: -------------------------------------------------------------------------------- 1 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 2 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 3 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 4 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/README.md: -------------------------------------------------------------------------------- 1 | # `@mongosh/js-multiline-to-singleline` 2 | 3 | Package for [MongoDB Shell](https://github.com/mongodb-js/mongosh). 4 | 5 | ### Installation 6 | 7 | ```shell 8 | npm install -S @mongosh/js-multiline-to-singleline 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/logging/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/shell-api/src/mongosh-version.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * NOTE: Do not manually modify this file. 3 | * The MONGOSH_VERSION gets generated automatically during mongosh releases. 4 | **/ 5 | 6 | /** Current mongosh cli-repl version. */ 7 | export const MONGOSH_VERSION = '2.5.10'; 8 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/snippet-manager/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /.evergreen/create-static-analysis-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | 5 | npm run create-static-analysis-report -- --first-party-deps-list-files="${FIRST_PARTY_DEPENDENCY_FILENAMES}" 6 | (cd .sbom && tar czvf ../static-analysis-report.tgz codeql.md codeql.sarif.json) 7 | -------------------------------------------------------------------------------- /configs/eslint-config-mongosh/AUTHORS: -------------------------------------------------------------------------------- 1 | Le Roux Bodenstein 2 | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 3 | Gagik Amaryan 4 | mongodb-devtools-bot[bot] <189715634+mongodb-devtools-bot[bot]@users.noreply.github.com> 5 | -------------------------------------------------------------------------------- /packages/async-rewriter2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/autocomplete/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/build/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 30000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/build/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | resources/ 17 | -------------------------------------------------------------------------------- /packages/e2e-tests/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | dist/ 17 | -------------------------------------------------------------------------------- /packages/errors/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 15000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/i18n/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/java-shell/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/test/js/run-tests.ts"], 6 | "color": true 7 | } 8 | 9 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/totalIndexSize.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({key: "value"}); 4 | // command dontCheckValue 5 | db.coll.totalIndexSize(); 6 | // clear 7 | db.coll.drop(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/shell-bson/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "target": "es2020" 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/shell-evaluator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/snippet-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/cli-repl/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countDocuments.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.countDocuments(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithQuery.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.find({a: {$gt: 1}}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/replaceOneUpsert.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.replaceOne({a: 2}, {a: 3}, {upsert: true}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateManyUpsert.expected.txt: -------------------------------------------------------------------------------- 1 | AcknowledgedUpdateResult{matchedCount=0, modifiedCount=0, upsertedId=null} 2 | [ { "_id": , "a": 1 }, { "_id": , "a": 1 }, { "_id": , "a": 1 }, { "_id": , "a": 3, "b": 1 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Timestamp.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new Timestamp(100, 0)}); 3 | // command checkResultClass 4 | new Timestamp(100, 0) 5 | // command checkResultClass 6 | db.coll.find().toArray()[0].v; 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .evergreen/ 3 | .evergreen.yml 4 | .gitignore 5 | .jshintrc 6 | .jsfmtrc 7 | .travis.yml 8 | .zuul.yml 9 | azure-pipelines.yml 10 | karma.conf.js 11 | lerna.json 12 | tsconfig.json 13 | notices/ 14 | src/ 15 | test/ 16 | -------------------------------------------------------------------------------- /packages/logging/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 15000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/shell-api/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/arg-parser/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/editor/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/history/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithQuery.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.count({a: {$gt: 1}}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithProjection.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.find({}, {_id: 0}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/tailable.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 3 | db.coll.insertOne({"_id": 2, name: "Petya"}); 4 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 5 | // command 6 | db.coll.find().tailable(); 7 | // clear 8 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberDecimal.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new NumberDecimal("24")}); 3 | // command checkResultClass 4 | new NumberDecimal("24") 5 | // command checkResultClass 6 | db.coll.find().toArray()[0].v; 7 | // clear 8 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/array.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: [1, 2, "hello \n world"]}); 3 | // command checkResultClass 4 | [1, 2, "hello \n world"] 5 | // command checkResultClass 6 | db.coll.find().toArray()[0].v; 7 | // clear 8 | db.coll.drop(); 9 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["./src/**/*.spec.*"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/shell-api/README.md: -------------------------------------------------------------------------------- 1 | # @mongosh/shell-api 2 | 3 | Provides the runtime-independent classes that make up the MongoDB Shell API, 4 | such as `Database`, `Collection`, etc., and the global objects and APIs 5 | available to shell users, such as `db`, `rs`, `sh`, `console`, `print()`, etc. 6 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/autocomplete/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/browser-repl/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/build/test/fixtures/deb-template/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: {{name}} 2 | Version: {{version}} 3 | Section: utils 4 | Priority: optional 5 | Architecture: amd64 6 | Installed-Size: {{size}} 7 | Maintainer: {{maintainer}} 8 | Homepage: {{homepage}} 9 | Description: {{description}} 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/batchSize.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: "a"}); 4 | db.coll.insertOne({a: "A"}); 5 | db.coll.insertOne({a: "á"}); 6 | // command 7 | db.coll.find({a: "a"}).batchSize(10); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/DBRef.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new DBRef('namespace', 'oid')}); 3 | // command checkResultClass 4 | new DBRef('namespace', 'oid') 5 | // command checkResultClass 6 | db.coll.find().toArray()[0].v; 7 | // clear 8 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/service-provider-core/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/snippet-manager/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/estimatedDocumentCount.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.estimatedDocumentCount(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithRegexp.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 'cat1'}); 4 | db.coll.insertOne({a: 'cat2'}); 5 | db.coll.insertOne({a: 'cat3'}); 6 | // command 7 | db.coll.find({a: /cat/}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /scripts/docker/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | if [ -t 0 ]; then # Check whether input is a TTY 6 | DOCKER_FLAGS='-it' 7 | else 8 | DOCKER_FLAGS='-i' 9 | fi 10 | docker run --rm $DOCKER_FLAGS -e MONGOSH_SMOKE_TEST_SERVER -e IS_CI --network host "mongosh-${1}" ${@:2} 11 | -------------------------------------------------------------------------------- /packages/arg-parser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "rootDir": "./src", 6 | "allowJs": true 7 | }, 8 | "include": ["src/**/*"], 9 | "exclude": ["./src/**/*.spec.*"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./src/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /.logs/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/Dockerfile.node20: -------------------------------------------------------------------------------- 1 | FROM node:20 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | RUN apt-get update 5 | RUN apt-get install -y krb5-user 6 | 7 | COPY krb5.conf /etc/krb5.conf 8 | COPY kerberos-run.sh /tmp/kerberos-run.sh 9 | 10 | CMD [ "/tmp/kerberos-run.sh" ] 11 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": ["../../scripts/import-expansions.js", "ts-node/register"], 3 | "timeout": 60000, 4 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 5 | "spec": ["./{src,lib}/**/*.spec.ts"], 6 | "exclude": ["**/node_modules/**"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/async-rewriter2/bin/async-rewrite.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const AsyncWriter = require('../').default; 4 | const fs = require('fs'); 5 | const input = fs.readFileSync(process.argv[2], 'utf8'); 6 | const asyncWriter = new AsyncWriter(); 7 | process.stdout.write(asyncWriter.process(input)); 8 | -------------------------------------------------------------------------------- /packages/build/src/npm-packages/types.ts: -------------------------------------------------------------------------------- 1 | export type PackagePublisherConfig = { 2 | isDryRun?: boolean; 3 | useAuxiliaryPackagesOnly?: boolean; 4 | }; 5 | 6 | export interface LernaPackageDescription { 7 | name: string; 8 | version: string; 9 | private: boolean; 10 | location: string; 11 | } 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findWithRegexpCaseInsensitive.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 'cat1'}); 4 | db.coll.insertOne({a: 'cat2'}); 5 | db.coll.insertOne({a: 'cat3'}); 6 | // command 7 | db.coll.find({a: /Cat/i}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/uniqueIndex.expected.txt: -------------------------------------------------------------------------------- 1 | category_1 2 | com.mongodb.MongoWriteException: Write operation error on server %mongohostport%. Write error: WriteError{code=11000, message='E11000 duplicate key error collection: admin.coll index: category_1 dup key: { : "cat1" }', details={}}. -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/itcount.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().itcount(); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MaxKey.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new MaxKey()}); 3 | // command checkResultClass 4 | new MaxKey(); 5 | // command checkResultClass 6 | MaxKey() 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MinKey.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new MinKey()}); 3 | // command checkResultClass 4 | new MinKey(); 5 | // command checkResultClass 6 | MinKey() 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); -------------------------------------------------------------------------------- /.evergreen/build-variants/compile-build-variants.d.ts: -------------------------------------------------------------------------------- 1 | export type CompileBuildVariant = { 2 | name: string; 3 | displayName: string; 4 | runOn: string; 5 | executableOsId: string; 6 | id?: string; 7 | sharedOpenSsl?: string; 8 | }; 9 | 10 | export const COMPILE_BUILD_VARIANTS: CompileBuildVariant[]; 11 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/Dockerfile.ubuntu2004: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | RUN apt-get update 5 | RUN apt-get install -y krb5-user 6 | 7 | COPY krb5.conf /etc/krb5.conf 8 | COPY kerberos-run.sh /tmp/kerberos-run.sh 9 | 10 | CMD [ "/tmp/kerberos-run.sh" ] 11 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/Dockerfile.ubuntu2204: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | RUN apt-get update 5 | RUN apt-get install -y krb5-user 6 | 7 | COPY krb5.conf /etc/krb5.conf 8 | COPY kerberos-run.sh /tmp/kerberos-run.sh 9 | 10 | CMD [ "/tmp/kerberos-run.sh" ] 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithLimit.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | db.coll.insertOne({a: 4}); 7 | // command 8 | db.coll.count({}, {limit: 3}); 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndDelete.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1, text: 'to delete'}); 4 | db.coll.insertOne({a: 1}); 5 | // command 6 | db.coll.findOneAndDelete({a: 1}); 7 | // command 8 | db.coll.find(); 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndReplaceWithReturnDocument.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | db.coll.findOneAndReplace({a: 1}, {a: 2}, {returnNewDocument: true}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/isCapped.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | // command 5 | wasCapped = db.coll.isCapped() 6 | // command 7 | db.coll.convertToCapped(10240) 8 | // command 9 | isCapped = db.coll.isCapped() 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/withPeriod.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.with.dot.remove({}); 3 | db.coll.with.dot.insertOne({a: 1}); 4 | db.coll.with.dot.insertOne({a: 2}); 5 | db.coll.with.dot.insertOne({a: 3}); 6 | // command 7 | db.coll.with.dot.find(); 8 | // clear 9 | db.coll.with.dot.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/comment.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().comment("hello") 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/hint.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().hint({_id: 1}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/isClosed.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().isClosed(); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/sort.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().sort({name: 1}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/uniqueIndex.expected.1.txt: -------------------------------------------------------------------------------- 1 | category_1 2 | com.mongodb.MongoWriteException: Write operation error on server %mongohostport%. Write error: WriteError{code=11000, message='E11000 duplicate key error collection: admin.coll index: category_1 dup key: { category: "cat1" }', details={}}. -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/collation.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: "a"}); 4 | db.coll.insertOne({a: "A"}); 5 | db.coll.insertOne({a: "á"}); 6 | // command 7 | db.coll.find({a: "a"}).collation({"locale": "en_US", strength: 1}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/countWithUnknownOption.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | db.coll.insertOne({a: 4}); 7 | // command 8 | db.coll.count({}, {unknown: 1}); 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/estimatedDocumentCountWithMaxTime.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.estimatedDocumentCount({maxTimeMS: 1000}); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/max.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().max({_id: 2}).hint({_id: 1}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/min.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().min({_id: 2}).hint({_id: 1}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/projection.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().projection({_id: 0}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/logging/src/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | MongoshAnalytics, 3 | ToggleableAnalytics, 4 | SampledAnalytics, 5 | NoopAnalytics, 6 | ThrottledAnalytics, 7 | } from './analytics-helpers'; 8 | export { MongoshLoggingAndTelemetry } from './types'; 9 | export { setupLoggingAndTelemetry } from './logging-and-telemetry'; 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateMany.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 1}); 5 | db.coll.insertOne({a: 1}); 6 | // command 7 | db.coll.updateMany({a: 1}, {$set: {b: 1}}); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOne.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 1}); 5 | db.coll.insertOne({a: 1}); 6 | // command 7 | db.coll.updateOne({a: 1}, {$set: {b: 1}}); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/map.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().map(function (u) {return u.name;}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/mapArrowFunction.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().map((u) => u.name); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/toArray.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command checkResultClass 7 | db.coll.find().toArray(); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/MD5.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new MD5('31323334')}); 3 | // command checkResultClass 4 | new MD5('31323334') 5 | // command checkResultClass 6 | MD5('31323334') 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/build/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | "allowJs": true, 6 | "removeComments": false, 7 | "resolveJsonModule": true 8 | }, 9 | "include": ["src/**/*"], 10 | "exclude": ["./src/**/*.spec.*"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndModify.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertMany([{v: "a", number: 1}, {v: "b", number: 1}]); 4 | // command 5 | db.coll.findAndModify({query: {"v": "a"}, update: {$inc: {number: 1}}}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertManyNotOrdered.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | // command 4 | db.coll.insertOne({_id: "b", name: "b"}); 5 | db.coll.insertMany([{_id: "b", name: "b"}, {_id: "d", name: "d"}], {ordered: false}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberInt.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new NumberInt("24")}); 3 | // command checkResultClass 4 | NumberInt("24") 5 | // command checkResultClass 6 | new NumberInt("24") 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/i18n/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/BSONSymbol.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new BSONSymbol('c')}); 3 | // command checkResultClass 4 | BSONSymbol('a') 5 | // command checkResultClass 6 | new BSONSymbol('b') 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/Code.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: Code('code', { k: 'v' })}); 3 | // command checkResultClass 4 | Code('code', { k: 'v' }) 5 | // command checkResultClass 6 | Code('code') 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/NumberLong.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new NumberLong("24")}); 3 | // command checkResultClass 4 | NumberLong("24") 5 | // command checkResultClass 6 | new NumberLong("24") 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/testing/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/types/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/arg-parser/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/editor/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/errors/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/history/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'cursor.batchSize must not be negative' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "cursor.batchSize must not be negative", "code": 2, "codeName": "BadValue"} 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollection.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.drop(); 3 | db.newName.drop(); 4 | db.coll.insertOne({a: 1}); 5 | // command 6 | db.coll.renameCollection('newName'); 7 | // command 8 | db.coll.find(); 9 | // command 10 | db.newName.find(); 11 | // clear 12 | db.coll.drop(); 13 | db.newName.drop(); 14 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/aggregateIsClosed.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.aggregate([{$sort: {_id: -1}}]).isClosed(); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/logging/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/src/index.ts: -------------------------------------------------------------------------------- 1 | import { NodeDriverServiceProvider } from './node-driver-service-provider'; 2 | import { CompassServiceProvider } from './compass/compass-service-provider'; 3 | export type { DevtoolsConnectOptions } from '@mongodb-js/devtools-connect'; 4 | export { NodeDriverServiceProvider, CompassServiceProvider }; 5 | -------------------------------------------------------------------------------- /packages/shell-api/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/shell-bson/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/async-rewriter2/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/autocomplete/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/browser-repl/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateManyUpsert.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 1}); 5 | db.coll.insertOne({a: 1}); 6 | // command 7 | db.coll.updateMany({a: 3}, {$set: {b: 1}}, {upsert: true}); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/shell-evaluator/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/snippet-manager/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /scripts/docker/README.md: -------------------------------------------------------------------------------- 1 | # Docker test images 2 | 3 | This folder contains scripts and Dockerfiles to test the main branch build of mongosh on different linux distributions. 4 | 5 | ## Usage 6 | 7 | ``` 8 | bash scripts/docker/build.sh ubuntu20.04-deb 9 | ``` 10 | 11 | ``` 12 | bash scripts/docker/run.sh ubuntu20.04-deb arg1 arg2 ... 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndCount.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertMany([{v: 1}, {v: 2}]); 4 | // command 5 | db.coll.find({v: 1}).count(); 6 | // command 7 | db.coll.find().limit(1).count(); 8 | // command 9 | db.coll.find({}, {}, {"comment": "hello"}).count(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findAndModifyWithNew.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertMany([{v: "a", number: 1}, {v: "b", number: 1}]); 4 | // command 5 | db.coll.findAndModify({query: {"v": "a"}, update: {$inc: {number: 1}}, new: true}); 6 | // command 7 | db.coll.find(); 8 | // clear 9 | db.coll.drop(); 10 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateManyPipeline.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 1}); 5 | db.coll.insertOne({a: 1}); 6 | // command 7 | db.coll.updateMany({a: 1}, [{$unset: ["a"]}, {$set: {b: 1}}]); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/updateOnePipeline.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 1}); 5 | db.coll.insertOne({a: 1}); 6 | // command 7 | db.coll.updateOne({a: 1}, [{$unset: ["a"]}, {$set: {b: 1}}]); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/next.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({name: "value1", v: 1}); 4 | db.coll.insertOne({name: "value2", v: 2}); 5 | db.coll.insertOne({name: "value2", v: 3}); 6 | // command 7 | db.coll.find().next(); 8 | // command 9 | db.coll.find().next().name; 10 | // clear 11 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "allowJs": true, 6 | "lib": ["WebWorker"] 7 | }, 8 | "files": ["./src/index.d.ts"], 9 | "include": ["src/**/*"], 10 | "exclude": ["./src/**/*.spec.*"] 11 | } 12 | -------------------------------------------------------------------------------- /configs/tsconfig-mongosh/AUTHORS: -------------------------------------------------------------------------------- 1 | Le Roux Bodenstein 2 | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 3 | Anna Henningsen 4 | Paula Stachova 5 | Gagik Amaryan 6 | mongodb-devtools-bot[bot] <189715634+mongodb-devtools-bot[bot]@users.noreply.github.com> 7 | -------------------------------------------------------------------------------- /packages/browser-runtime-electron/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndUpdate.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.findOneAndUpdate({a: 1}, {$inc: {a: 5}}, {sort: {a: -1}}); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/HexData.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new HexData(16, '31323334')}); 3 | // command checkResultClass 4 | new HexData(16, '31323334') 5 | // command checkResultClass 6 | HexData(16, '31323334') 7 | // command checkResultClass 8 | db.coll.find().toArray()[0].v; 9 | // clear 10 | db.coll.drop(); 11 | -------------------------------------------------------------------------------- /packages/service-provider-core/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/browser-runtime-core/src/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | Runtime, 3 | RuntimeEvaluationListener, 4 | RuntimeEvaluationResult, 5 | } from './runtime'; 6 | export { 7 | OpenContextRuntime, 8 | ContextValue, 9 | InterpreterEnvironment, 10 | } from './open-context-runtime'; 11 | export { Autocompleter, Completion } from './autocompleter/autocompleter'; 12 | -------------------------------------------------------------------------------- /packages/js-multiline-to-singleline/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/service-provider-node-driver/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils'); 2 | 3 | module.exports = { 4 | root: true, 5 | extends: ['@mongodb-js/eslint-config-mongosh'], 6 | parserOptions: { 7 | tsconfigRootDir: fixCygwinPath(__dirname), 8 | project: ['./tsconfig-lint.json'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/shell-api/src/deep-inspect/ts-helpers.ts: -------------------------------------------------------------------------------- 1 | export type UnionToIntersection = ( 2 | T extends any ? (k: T) => void : never 3 | ) extends (k: infer U) => void 4 | ? U 5 | : never; 6 | 7 | export type PickMethodsByReturnType = { 8 | [k in keyof T as NonNullable extends (...args: any[]) => R 9 | ? k 10 | : never]: T[k]; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/node-runtime-worker-thread/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": [ 3 | "../../scripts/import-expansions.js", 4 | "./tests/register-worker.js", 5 | "ts-node/register" 6 | ], 7 | "timeout": 15000, 8 | "reporter": "../../configs/mocha-config-mongosh/reporter.ts", 9 | "spec": ["./src/**/*.spec.ts"], 10 | "exclude": ["**/node_modules/**"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/cli-repl/src/error-codes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @mongoshErrors 3 | */ 4 | export const CliReplErrors = { 5 | /** 6 | * Signals that the currently installed Node version does not match the one expected by mongosh. 7 | * 8 | * See the output for further details on the required Node version. 9 | */ 10 | NodeVersionMismatch: 'CLIREPL-10001', 11 | } as const; 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/returnKey.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command 7 | db.coll.find().returnKey(); 8 | // command 9 | db.coll.find().returnKey(true); 10 | // clear 11 | db.coll.drop(); -------------------------------------------------------------------------------- /packaging/deb-template/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: {{debName}} 2 | Provides: {{provides}} 3 | Version: {{version}} 4 | Section: utils 5 | Priority: optional 6 | Architecture: {{debianArch}} 7 | Installed-Size: {{size}} 8 | Maintainer: {{maintainer}} 9 | Homepage: {{homepage}} 10 | Description: {{description}} 11 | Depends: {{debDepends}} 12 | Recommends: {{debRecommends}} 13 | -------------------------------------------------------------------------------- /packages/service-provider-core/src/closable.ts: -------------------------------------------------------------------------------- 1 | export default interface Closable { 2 | /** 3 | * Close the connection. 4 | */ 5 | close(): Promise; 6 | 7 | /** 8 | * Suspends the connection, i.e. temporarily force-closes it 9 | * and returns a function that will re-open the connection. 10 | */ 11 | suspend(): Promise<() => Promise>; 12 | } 13 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/findOneAndUpdateWithReturnDocument.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.findOneAndUpdate({a: 1}, {$inc: {a: 5}}, {returnNewDocument: true}); 8 | // command 9 | db.coll.find(); 10 | // clear 11 | db.coll.drop(); 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertManyNotOrdered.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoBulkWriteException: Bulk write operation error on server %mongohostport%. Write errors: [BulkWriteError{index=0, code=11000, message='E11000 duplicate key error collection: admin.coll index: _id_ dup key: { _id: "b" }', details={}}]. 2 | [ { "_id": "b", "name": "b" }, { "_id": "d", "name": "d" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/insertManyNotOrdered.expected.1.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoBulkWriteException: Bulk write operation error on server %mongohostport%. Write errors: [BulkWriteError{index=0, code=11000, message='E11000 duplicate key error collection: admin.coll index: _id_ dup key: { : "b" }', details={}}]. 2 | [ { "_id": "b", "name": "b" }, { "_id": "d", "name": "d" } ] 3 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/forEach.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | const result = []; 7 | // command 8 | db.coll.find().forEach(d => result.push(d)); 9 | // command 10 | result 11 | // clear 12 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.4.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'BSON field 'batchSize' value must be >= 0, actual value '-1'' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "BSON field 'batchSize' value must be >= 0, actual value '-1'", "code": 2, "codeName": "BadValue"} 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollectionAlreadyExists.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.drop(); 3 | db.newName.drop(); 4 | db.coll.insertOne({a: 1}); 5 | db.newName.insertOne({a: 2}); 6 | // command 7 | db.coll.renameCollection('newName'); 8 | // command 9 | db.coll.find(); 10 | // command 11 | db.newName.find(); 12 | // clear 13 | db.coll.drop(); 14 | db.newName.drop(); 15 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollectionDropTarget.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.drop(); 3 | db.newName.drop(); 4 | db.coll.insertOne({a: 1}); 5 | db.newName.insertOne({a: 2}); 6 | // command 7 | db.coll.renameCollection('newName', true); 8 | // command 9 | db.coll.find(); 10 | // command 11 | db.newName.find(); 12 | // clear 13 | db.coll.drop(); 14 | db.newName.drop(); 15 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/aggregateReadPref.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "_id": , "a": "a" }, { "_id": , "a": "A" }, { "_id": , "a": "\u00E1" } ] 2 | [ { "_id": , "a": "a" }, { "_id": , "a": "A" }, { "_id": , "a": "\u00E1" } ] 3 | [ { "_id": , "a": "a" }, { "_id": , "a": "A" }, { "_id": , "a": "\u00E1" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/print.expected.txt: -------------------------------------------------------------------------------- 1 | [ { "0": { "_id": , "a": 1 } }, { "0": { "_id": , "a": 2 } }, { "0": { "_id": , "a": 3 } } ] 2 | [ { "0": "my document", "1": { "_id": , "a": 1 } }, { "0": "my document", "1": { "_id": , "a": 2 } }, { "0": "my document", "1": { "_id": , "a": 3 } } ] 3 | [ { "0": "Hello, world!" } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/BinData.expected.txt: -------------------------------------------------------------------------------- 1 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 2 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 3 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "04"}} 4 | UUIDResult: 5220b418-8f7d-4cd9-bd27-35b6f8d990c5 5 | BinaryResult: {"$binary": {"base64": "MTIzNA==", "subType": "10"}} 6 | -------------------------------------------------------------------------------- /packages/java-shell/src/main/kotlin/com/mongodb/mongosh/MongoshDate.kt: -------------------------------------------------------------------------------- 1 | package com.mongodb.mongosh 2 | 3 | import org.graalvm.polyglot.HostAccess 4 | import java.util.* 5 | 6 | /** 7 | * @author Liudmila Kornilova 8 | **/ 9 | class MongoshDate(date: Long) : Date(date) { 10 | @HostAccess.Export 11 | override fun getTime(): Long { 12 | return super.getTime() 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/connectivity-tests/test/kerberos/krb5.conf: -------------------------------------------------------------------------------- 1 | [libdefaults] 2 | default_realm = EXAMPLE.COM 3 | dns_canonicalize_hostname = false 4 | dns_lookup_kdc = false 5 | dns_lookup_realm = false 6 | 7 | [realms] 8 | EXAMPLE.COM = { 9 | kdc = kdc-kadmin 10 | admin_server = kdc-kadmin 11 | } 12 | EXAMPLE2.COM = { 13 | kdc = kdc-kadmin2 14 | admin_server = kdc-kadmin2 15 | } 16 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/renameCollectionAlreadyExists.expected.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoCommandException: Command failed with error 48 (NamespaceExists): 'target namespace exists' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "target namespace exists", "code": 48, "codeName": "NamespaceExists"} 2 | [ { "_id": , "a": 1 } ] 3 | [ { "_id": , "a": 2 } ] -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/print.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.drop(); 3 | db.coll.insertOne({a: 1}); 4 | db.coll.insertOne({a: 2}); 5 | db.coll.insertOne({a: 3}); 6 | // command 7 | db.coll.find().forEach(d => print(d)); 8 | 1 9 | // command 10 | db.coll.find().forEach(d => print("my document", d)); 11 | // command 12 | console.log("Hello, world!") 13 | // clear 14 | db.coll.drop(); 15 | -------------------------------------------------------------------------------- /packages/testing/dummy.spec.ts: -------------------------------------------------------------------------------- 1 | // This is just a dummy test to make Mocha Test Explorer work. 2 | // Should be removed as part of testing refactoring. 3 | /* eslint-disable @typescript-eslint/ban-ts-comment */ 4 | // @ts-ignore 5 | describe('These tests are not run by Mocha Test explorer', function () { 6 | // @ts-ignore 7 | it('should pass', function () { 8 | return true; 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.2.txt: -------------------------------------------------------------------------------- 1 | org.graalvm.polyglot.PolyglotException: Command failed with error 51024 (Location51024): 'BSON field 'cursor' value must be >= 0, actual value '-1'' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "BSON field 'cursor' value must be >= 0, actual value '-1'", "code": 51024, "codeName": "Location51024"} 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/cursor/aggregateExplain.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({"_id": 1, name: "Vasya"}); 4 | db.coll.insertOne({"_id": 2, name: "Petya"}); 5 | db.coll.insertOne({"_id": 3, name: "Lyusya"}); 6 | // command extractProperty=ok 7 | db.coll.explain().aggregate([{$sort: {_id: -1}}], {collation: {"locale": "en_US", strength: 1}}); 8 | // clear 9 | db.coll.drop(); -------------------------------------------------------------------------------- /.evergreen/build-variants/e2e-tests-build-variants.d.ts: -------------------------------------------------------------------------------- 1 | export type E2ETestsBuildVariant = { 2 | displayName: string; 3 | name: string; 4 | compileBuildVariant: string; 5 | runOn: string; 6 | executableOsId: string; 7 | mVersion: string; 8 | tags?: string[]; 9 | fips?: boolean; 10 | additionalTasks?: string[]; 11 | }; 12 | 13 | export const E2E_TESTS_BUILD_VARIANTS: E2ETestsBuildVariant[]; 14 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.1.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoCommandException: Command failed with error 51024 (Location51024): 'BSON field 'batchSize' value must be >= 0, actual value '-1'' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "BSON field 'batchSize]' value must be >= 0, actual value '-1'", "code": 51024, "codeName": "Location51024"} 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.3.txt: -------------------------------------------------------------------------------- 1 | com.mongodb.MongoCommandException: Command failed with error 51024 (Location51024): 'BSON field 'batchSize' value must be >= 0, actual value '-1'' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "BSON field 'batchSize' value must be >= 0, actual value '-1'", "code": 51024, "codeName": "Location51024"} 2 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/uniqueIndex.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({category: "cat1", v: 1}); 4 | db.coll.insertOne({category: "cat2", v: 2}); 5 | db.coll.insertOne({category: "cat3", v: 3}); 6 | // command 7 | db.coll.createIndex({category: 1}, {unique: true}); 8 | // command 9 | db.coll.insertOne({category: "cat1", v: 1}); 10 | // clear 11 | db.coll.drop() 12 | -------------------------------------------------------------------------------- /scripts/dummy-browserslist.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // Babel has a dependency on browserslist (and in particular, 3 | // caniuse-lite through browserslist, which is a fairly large 4 | // npm package). However, the way in which we use babel does 5 | // not actually require browserslist support, so we can safely 6 | // stub this away. 7 | module.exports = () => { 8 | throw new Error('browserslist not supported'); 9 | }; 10 | -------------------------------------------------------------------------------- /packages/browser-repl/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "outDir": "lib", 5 | "jsx": "react", 6 | "lib": ["dom"], 7 | // react-ace types are incorrect: https://github.com/securingsincity/react-ace/issues/1547 8 | "skipLibCheck": true 9 | }, 10 | "include": ["src/**/*"], 11 | "exclude": ["./src/**/*.spec.*"] 12 | } 13 | -------------------------------------------------------------------------------- /packages/service-provider-core/src/all-fle-types.ts: -------------------------------------------------------------------------------- 1 | export type { 2 | AWSEncryptionKeyOptions, 3 | AzureEncryptionKeyOptions, 4 | GCPEncryptionKeyOptions, 5 | ClientEncryption, 6 | ClientEncryptionCreateDataKeyProviderOptions, 7 | ClientEncryptionDataKeyProvider, 8 | ClientEncryptionEncryptOptions, 9 | ClientEncryptionOptions, 10 | ClientEncryptionTlsOptions, 11 | KMSProviders, 12 | } from 'mongodb'; 13 | -------------------------------------------------------------------------------- /packages/testing/src/index.browser.ts: -------------------------------------------------------------------------------- 1 | export * from './eventually'; 2 | export * from './chai'; 3 | 4 | /** 5 | * Path to the certificates directory containing test certificates 6 | */ 7 | const TEST_CERTIFICATES_DIR = './certificates'; 8 | 9 | /** Get the path to a test certificate */ 10 | export function getTestCertificatePath(filename: string): string { 11 | return `${TEST_CERTIFICATES_DIR}/${filename}`; 12 | } 13 | -------------------------------------------------------------------------------- /packages/e2e-tests/test/fixtures/curl.mjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import fetch from 'node-fetch'; 3 | 4 | if (process.env.MONGOSH_E2E_TEST_CURL_ALLOW_INVALID_TLS) { 5 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; 6 | } 7 | 8 | // fetch() an URL and ignore the response body 9 | (async function () { 10 | (await fetch(process.argv[2])).body?.resume(); 11 | })().catch(err => { process.nextTick(() => { throw err; }); }); 12 | -------------------------------------------------------------------------------- /.snyk: -------------------------------------------------------------------------------- 1 | # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. 2 | version: v1.25.0 3 | # ignores vulnerabilities until expiry date; change duration by modifying expiry date 4 | ignore: 5 | SNYK-JS-AXIOS-6032459: 6 | - '*': 7 | reason: Not applicable to axios usage inside node-analytics package 8 | expires: 2024-12-08T16:13:38.499Z 9 | created: 2023-11-08T16:13:38.503Z 10 | patch: {} 11 | -------------------------------------------------------------------------------- /packages/shell-api/src/api.ts: -------------------------------------------------------------------------------- 1 | export { CollectionWithSchema } from './collection'; 2 | export { ShellBson } from '@mongosh/shell-bson'; 3 | export { Streams } from './streams'; 4 | export { DatabaseWithSchema } from './database'; 5 | import Shard from './shard'; 6 | import ReplicaSet from './replica-set'; 7 | import ShellApi from './shell-api'; 8 | import Mongo from './mongo'; 9 | 10 | export { Mongo, Shard, ReplicaSet, ShellApi }; 11 | -------------------------------------------------------------------------------- /scripts/security-test-summary-template.md: -------------------------------------------------------------------------------- 1 | # MongoDB Shell Security Testing Summary 2 | 3 | This document lists specific instances of security-relevant testing that is being 4 | performed for the MongoDB Shell. All parts of the MongoDB Shell source code 5 | are subject to integration and unit testing on every change made to the project, 6 | including the specific instances listed below. 7 | 8 | # Security Tests 9 | 10 | __SUMMARY__ 11 | -------------------------------------------------------------------------------- /packages/errors/scripts/error-overview.tmpl.md: -------------------------------------------------------------------------------- 1 | # mongosh Error Codes Overview 2 | 3 | To quickly find an error by its code, search for the code in this overview. 4 | 5 | ## Table of Contents 6 | 7 | {{#each packages}} 8 | 9 | - [{{package}}](#{{package}}) 10 | {{/each}} 11 | 12 | {{#each packages}} 13 | 14 | ## {{package}} 15 | 16 | {{#each errors}} 17 | 18 | #### `{{code}}` 19 | 20 | {{{documentation}}} 21 | {{/each}} 22 | 23 | {{/each}} 24 | -------------------------------------------------------------------------------- /packaging/README: -------------------------------------------------------------------------------- 1 | This package contains `mongosh`, the mongo shell. 2 | Additionally, it includes a shared library, `mongosh_crypt_v1`, as well as a 3 | manual page `mongosh.1.gz` that can be viewed using the `man` command line 4 | utility, and their respective licensing files. 5 | 6 | Extract them to a suitable location. 7 | 8 | For licensing information: 9 | 10 | - mongosh: See LICENSE-mongosh 11 | - mongosh_crypt_v1: See LICENSE-crypt-library 12 | -------------------------------------------------------------------------------- /scripts/create-purls.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const fs = require('fs'); 4 | for (const file of process.argv.slice(2)) { 5 | for (const { name, version } of JSON.parse(fs.readFileSync(file, 'utf8'))) { 6 | if (name === '.node.js') { 7 | console.log(`pkg:generic/node@${encodeURIComponent(version)}`); 8 | } else { 9 | console.log(`pkg:npm/${encodeURIComponent(name)}@${encodeURIComponent(version)}`); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .lock-wscript 3 | .idea/ 4 | .vscode/ 5 | *.iml 6 | .npmrc 7 | .nvmrc 8 | .nyc_output 9 | *.swp 10 | lerna-debug.log 11 | lib-cov 12 | npm-debug.log 13 | .idea/ 14 | coverage/ 15 | dist/ 16 | node_modules/ 17 | .lock-wscript 18 | .cache/ 19 | expansions.yaml 20 | tmp/expansions.yaml 21 | .evergreen/mongodb 22 | tmp/ 23 | dist.tgz 24 | compiled-ts.tgz 25 | mongocryptd.pid 26 | .sbom 27 | .nvm 28 | snapshot.blob 29 | .logs/* 30 | !.logs/empty.xml 31 | -------------------------------------------------------------------------------- /.evergreen/create-preload-script.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -e 3 | set +x 4 | cat < preload.sh 5 | echo "Preload script starting" 6 | set -e 7 | set -x 8 | export ARTIFACT_URL=$(cat ../artifact-url.txt) 9 | export IS_CI=1 10 | set +x 11 | export MONGOSH_SMOKE_TEST_SERVER="mongodb+srv://${connectivity_test_atlas_username}:${connectivity_test_atlas_password}@${connectivity_test_atlas_hostname}/" 12 | echo "Preload script done" 13 | set -x 14 | PRELOAD_SCRIPT -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Development Documentation 2 | 3 | This folder contains development-specific documentation on the inner workings of `mongosh` and its packages. 4 | 5 | > If you are looking for end-user documentation, please refer to: https://www.mongodb.com/docs/mongodb-shell/. 6 | 7 | ## Topics 8 | Go to any of the linked topics for details: 9 | 10 | * [CLI REPL Code Evaluation](./cli-code-evaluation.md) 11 | * [Interrupting Async Execution](./interrupting-async-execution.md) -------------------------------------------------------------------------------- /packages/async-rewriter2/benchmark/index.ts: -------------------------------------------------------------------------------- 1 | import AsyncWriter from '../src/index'; 2 | 3 | const RUNS = 10; 4 | 5 | const start = process.hrtime.bigint(); 6 | for (let i = 0; i < RUNS; i++) 7 | new AsyncWriter().unprocessedRuntimeSupportCode(); 8 | const stop = process.hrtime.bigint(); 9 | 10 | // eslint-disable-next-line no-console 11 | console.log( 12 | 'Time for processing runtime support code', 13 | Number(stop - start) / 1_000_000 / RUNS, 14 | 'ms' 15 | ); 16 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["packages/*/src/**", "scripts/*/src/**", "configs/*/src/**"], 3 | "exclude": [ 4 | "test", 5 | "packages/testing", 6 | "config", 7 | "**/*.d.ts", 8 | "**/*.spec.{ts,js,tsx,jsx,cjs,mjs}", 9 | "**/test/**/*.{ts,js,tsx,jsx,cjs,mjs}", 10 | "**/tmp/**/*.{ts,js,tsx,jsx,cjs,mjs}", 11 | "**/*.config.{ts,js,tsx,jsx,cjs,mjs}", 12 | "**/lib/*.js", 13 | "**/dist/**/*.js", 14 | "**/src/*.nocov.{ts,js}" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/testing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "outDir": "./lib", 6 | "declaration": true, 7 | "declarationMap": true 8 | }, 9 | "include": [ 10 | "src/**/*", 11 | "src/certificates/**/*", 12 | "src/chai.ts", 13 | "../browser-repl/testing/enzyme.ts", 14 | "../browser-repl/testing/enzyme.ts" 15 | ], 16 | "exclude": ["lib"] 17 | } 18 | -------------------------------------------------------------------------------- /.evergreen/build-variants/unit-tests-build-variants.d.ts: -------------------------------------------------------------------------------- 1 | export type UnitTestsBuildVariant = { 2 | displayName: string; 3 | runOn: string; 4 | executableOsId: string; 5 | name: string; 6 | id: string; 7 | runWithUnitTestsOnly: boolean; 8 | tags: string[]; 9 | platform: string; 10 | nShort: string; 11 | nVersion: string; 12 | skipNodeVersionCheck: boolean; 13 | disable: boolean; 14 | }; 15 | 16 | export const UNIT_TESTS_BUILD_VARIANTS: UnitTestsBuildVariant[]; 17 | -------------------------------------------------------------------------------- /config/macos-entitlements.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.allow-jit 6 | 7 | com.apple.security.cs.allow-unsigned-executable-memory 8 | 9 | com.apple.security.cs.disable-executable-page-protection 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/java-shell/src/main/kotlin/com/mongodb/mongosh/result/FindCursor.kt: -------------------------------------------------------------------------------- 1 | package com.mongodb.mongosh.result 2 | 3 | import com.mongodb.mongosh.MongoShellConverter 4 | import org.graalvm.polyglot.Value 5 | 6 | class FindCursor internal constructor(cursor: Value?, converter: MongoShellConverter) : Cursor(cursor, converter) { 7 | fun batchSize(size: Int) { 8 | val (cursor, _) = checkClosed() 9 | cursor.invokeMember("batchSize", size) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/literal/ObjectId.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.insertOne({"_id": 1, v: new ObjectId('5ebaf064121756574a9767cf')}); 3 | // command checkResultClass dontReplaceId 4 | new ObjectId('5ebaf064121756574a9767cf') 5 | // command checkResultClass dontReplaceId 6 | ObjectId('5ebaf064121756574a9767cf') 7 | // command checkResultClass 8 | new ObjectId() 9 | // command checkResultClass dontReplaceId 10 | db.coll.find().toArray()[0].v; 11 | // clear 12 | db.coll.drop(); -------------------------------------------------------------------------------- /packages/java-shell/src/test/resources/collection/dropIndexes.js: -------------------------------------------------------------------------------- 1 | // before 2 | db.coll.deleteMany({}); 3 | db.coll.insertOne({category: "cat1", v: 1}); 4 | db.coll.insertOne({category: "cat2", v: 2}); 5 | db.coll.insertOne({category: "cat2", v: 3}); 6 | db.coll.createIndex({category: 1}, {collation: {locale: "fr"}}); 7 | db.coll.createIndex({v: 1}); 8 | // command 9 | db.coll.dropIndexes(['category_1', 'v_1']); 10 | // command 11 | db.coll.getIndexes(); 12 | // clear 13 | db.coll.drop(); 14 | --------------------------------------------------------------------------------