diff --git a/README.md b/README.md index a1f6c95e41b..5009c4b680b 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,18 @@ -[![npm](https://nodei.co/npm/mongodb.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mongodb/) [![npm](https://nodei.co/npm-dl/mongodb.png?months=6&height=3)](https://nodei.co/npm/mongodb/) - -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -# Description +# MongoDB NodeJS Driver The official [MongoDB](https://www.mongodb.com/) driver for Node.js. -**NOTE: v3.x was recently released with breaking API changes. You can find a list of changes [here](CHANGES_3.0.0.md).** +**NOTE: v4.x was recently released with breaking API changes. You can find a list of changes [here](docs/CHANGES_4.0.0.md).** -## MongoDB Node.JS Driver +## Quick Links -| what | where | -|---------------|--------------------------------------------------------| -| documentation | https://docs.mongodb.com/drivers/node | -| api-doc | https://mongodb.github.io/node-mongodb-native/3.6/api/ | -| source | https://github.com/mongodb/node-mongodb-native | -| mongodb | https://www.mongodb.com | +| what | where | +|---------------|------------------------------------------------------------------------------------------------------------------| +| documentation | [https://docs.mongodb.com/drivers/node](https://docs.mongodb.com/drivers/node) | +| api-doc | [https://mongodb.github.io/node-mongodb-native/4.0/api/](https://mongodb.github.io/node-mongodb-native/4.0/api/) | +| npm package | [https://www.npmjs.com/package/mongodb](https://www.npmjs.com/package/mongodb) | +| source | [https://github.com/mongodb/node-mongodb-native](https://github.com/mongodb/node-mongodb-native) | +| mongodb | [https://www.mongodb.com](https://www.mongodb.com) | ### Bugs / Feature Requests @@ -41,99 +38,33 @@ Change history can be found in [`HISTORY.md`](HISTORY.md). For version compatibility matrices, please refer to the following links: - * [MongoDB](https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#reference-compatibility-mongodb-node) - * [NodeJS](https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#reference-compatibility-language-node) +- [MongoDB](https://docs.mongodb.com/drivers/node/compatibility#mongodb-compatibility) +- [NodeJS](https://docs.mongodb.com/drivers/node/compatibility#language-compatibility) -# Installation +## Installation -The recommended way to get started using the Node.js 3.0 driver is by using the `npm` (Node Package Manager) to install the dependency in your project. +The recommended way to get started using the Node.js 4.0 driver is by using the `npm` (Node Package Manager) to install the dependency in your project. -## MongoDB Driver - -Given that you have created your own project using `npm init` we install the MongoDB driver and its dependencies by executing the following `npm` command. +After you've created your own project using `npm init`, you can run: ```bash -npm install mongodb --save +npm install mongodb +# or ... +yarn add mongodb ``` This will download the MongoDB driver and add a dependency entry in your `package.json` file. -You can also use the [Yarn](https://yarnpkg.com/en) package manager. - ## Troubleshooting The MongoDB driver depends on several other packages. These are: -* [mongodb-core](https://github.com/mongodb-js/mongodb-core) -* [bson](https://github.com/mongodb/js-bson) -* [kerberos](https://github.com/mongodb-js/kerberos) -* [node-gyp](https://github.com/nodejs/node-gyp) - -The `kerberos` package is a C++ extension that requires a build environment to be installed on your system. You must be able to build Node.js itself in order to compile and install the `kerberos` module. Furthermore, the `kerberos` module requires the MIT Kerberos package to correctly compile on UNIX operating systems. Consult your UNIX operation system package manager for what libraries to install. - -**Windows already contains the SSPI API used for Kerberos authentication. However, you will need to install a full compiler tool chain using Visual Studio C++ to correctly install the Kerberos extension.** - -### Diagnosing on UNIX - -If you don’t have the build-essentials, this module won’t build. In the case of Linux, you will need gcc, g++, Node.js with all the headers and Python. The easiest way to figure out what’s missing is by trying to build the Kerberos project. You can do this by performing the following steps. - -```bash -git clone https://github.com/mongodb-js/kerberos -cd kerberos -npm install -``` - -If all the steps complete, you have the right toolchain installed. If you get the error "node-gyp not found," you need to install `node-gyp` globally: - -```bash -npm install -g node-gyp -``` - -If it correctly compiles and runs the tests you are golden. We can now try to install the `mongod` driver by performing the following command. - -```bash -cd yourproject -npm install mongodb --save -``` - -If it still fails the next step is to examine the npm log. Rerun the command but in this case in verbose mode. - -```bash -npm --loglevel verbose install mongodb -``` - -This will print out all the steps npm is performing while trying to install the module. - -### Diagnosing on Windows - -A compiler tool chain known to work for compiling `kerberos` on Windows is the following. - -* Visual Studio C++ 2010 (do not use higher versions) -* Windows 7 64bit SDK -* Python 2.7 or higher +- [bson](https://github.com/mongodb/js-bson) +- [bson-ext](https://github.com/mongodb-js/bson-ext) +- [kerberos](https://github.com/mongodb-js/kerberos) +- [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme) -Open the Visual Studio command prompt. Ensure `node.exe` is in your path and install `node-gyp`. - -```bash -npm install -g node-gyp -``` - -Next, you will have to build the project manually to test it. Clone the repo, install dependencies and rebuild: - -```bash -git clone https://github.com/christkv/kerberos.git -cd kerberos -npm install -node-gyp rebuild -``` - -This should rebuild the driver successfully if you have everything set up correctly. - -### Other possible issues - -Your Python installation might be hosed making gyp break. Test your deployment environment first by trying to build Node.js itself on the server in question, as this should unearth any issues with broken packages (and there are a lot of broken packages out there). - -Another tip is to ensure your user has write permission to wherever the Node.js modules are being installed. +Some of these packages include native C++ extensions, consult the [trouble shooting guide here](docs/native-extensions.md) if you run into issues. ## Quick Start @@ -144,24 +75,22 @@ This guide will show you how to set up a simple application using Node.js and Mo First, create a directory where your application will live. ```bash -mkdir myproject -cd myproject +mkdir myProject +cd myProject ``` Enter the following command and answer the questions to create the initial structure for your new project: ```bash -npm init +npm init -y ``` -Next, install the driver dependency. +Next, install the driver as a dependency. ```bash -npm install mongodb --save +npm install mongodb ``` -You should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory. - ### Start a MongoDB Server For complete MongoDB installation instructions, see [the manual](https://docs.mongodb.org/manual/installation/). @@ -181,27 +110,41 @@ You should see the **mongod** process start up and print some status information Create a new **app.js** file and add the following code to try out some basic CRUD operations using the MongoDB driver. -Add code to connect to the server and the database **myproject**: +Add code to connect to the server and the database **myProject**: + +> **NOTE:** All the examples below use async/await syntax. +> +> However, all async API calls support an optional callback as the final argument, +> if a callback is provided a Promise will not be returned. ```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); +const { MongoClient } = require('mongodb') +// or as an es module: +// import { MongoClient } from 'mongodb' // Connection URL -const url = 'mongodb://localhost:27017'; +const url = 'mongodb://localhost:27017' +const client = new MongoClient(url) // Database Name -const dbName = 'myproject'; +const dbName = 'myProject' -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected successfully to server"); +async function main() { + // Use connect method to connect to the server + await client.connect() + console.log('Connected successfully to server') + const db = client.db(dbName) + const collection = db.collection('documents') - const db = client.db(dbName); + // the following code examples can be pasted here... - client.close(); -}); + return 'done.' +} + +main() + .then(console.log) + .catch(console.error) + .finally(() => client.close()) ``` Run your app from the command line with: @@ -218,127 +161,31 @@ Add to **app.js** the following function which uses the **insertMany** method to add three documents to the **documents** collection. ```js -const insertDocuments = function(db, callback) { - // Get the documents collection - const collection = db.collection('documents'); - // Insert some documents - collection.insertMany([ - {a : 1}, {a : 2}, {a : 3} - ], function(err, result) { - assert.equal(err, null); - assert.equal(3, result.result.n); - assert.equal(3, result.ops.length); - console.log("Inserted 3 documents into the collection"); - callback(result); - }); -} -``` - -The **insert** command returns an object with the following fields: - -* **result** Contains the result document from MongoDB -* **ops** Contains the documents inserted with added **_id** fields -* **connection** Contains the connection used to perform the insert - -Add the following code to call the **insertDocuments** function: - -```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); - -// Connection URL -const url = 'mongodb://localhost:27017'; - -// Database Name -const dbName = 'myproject'; - -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected successfully to server"); - - const db = client.db(dbName); - - insertDocuments(db, function() { - client.close(); - }); -}); -``` - -Run the updated **app.js** file: - -```bash -node app.js +const insertResult = await collection.insertMany([{ a: 1 }, { a: 2 }, { a: 3 }]) +console.log('Inserted documents =>', insertResult) ``` -The operation returns the following output: - -```bash -Connected successfully to server -Inserted 3 documents into the collection -``` +The **insertMany** command returns an object with information about the insert operations. ### Find All Documents Add a query that returns all the documents. ```js -const findDocuments = function(db, callback) { - // Get the documents collection - const collection = db.collection('documents'); - // Find some documents - collection.find({}).toArray(function(err, docs) { - assert.equal(err, null); - console.log("Found the following records"); - console.log(docs) - callback(docs); - }); -} +const findResult = await collection.find({}).toArray() +console.log('Found documents =>', findResult) ``` -This query returns all the documents in the **documents** collection. Add the **findDocument** method to the **MongoClient.connect** callback: - -```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); - -// Connection URL -const url = 'mongodb://localhost:27017'; - -// Database Name -const dbName = 'myproject'; - -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - const db = client.db(dbName); - - insertDocuments(db, function() { - findDocuments(db, function() { - client.close(); - }); - }); -}); -``` +This query returns all the documents in the **documents** collection. +If you add this below the insertMany example you'll see the document's you've inserted. ### Find Documents with a Query Filter Add a query filter to find only documents which meet the query criteria. ```js -const findDocuments = function(db, callback) { - // Get the documents collection - const collection = db.collection('documents'); - // Find some documents - collection.find({'a': 3}).toArray(function(err, docs) { - assert.equal(err, null); - console.log("Found the following records"); - console.log(docs); - callback(docs); - }); -} +const filteredDocs = await collection.find({ a: 3 }).toArray() +console.log('Found documents filtered by { a: 3 } =>', filteredDocs) ``` Only the documents which match ``'a' : 3`` should be returned. @@ -348,92 +195,19 @@ Only the documents which match ``'a' : 3`` should be returned. The following operation updates a document in the **documents** collection. ```js -const updateDocument = function(db, callback) { - // Get the documents collection - const collection = db.collection('documents'); - // Update document where a is 2, set b equal to 1 - collection.updateOne({ a : 2 } - , { $set: { b : 1 } }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Updated the document with the field a equal to 2"); - callback(result); - }); -} +const updateResult = await collection.updateOne({ a: 3 }, { $set: { b: 1 } }) +console.log('Updated documents =>', updateResult) ``` -The method updates the first document where the field **a** is equal to **2** by adding a new field **b** to the document set to **1**. Next, update the callback function from **MongoClient.connect** to include the update method. - -```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); - -// Connection URL -const url = 'mongodb://localhost:27017'; - -// Database Name -const dbName = 'myproject'; - -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected successfully to server"); - - const db = client.db(dbName); - - insertDocuments(db, function() { - updateDocument(db, function() { - client.close(); - }); - }); -}); -``` +The method updates the first document where the field **a** is equal to **3** by adding a new field **b** to the document set to **1**. `updateResult` contains information about whether there was a matching document to update or not. ### Remove a document Remove the document where the field **a** is equal to **3**. ```js -const removeDocument = function(db, callback) { - // Get the documents collection - const collection = db.collection('documents'); - // Delete document where a is 3 - collection.deleteOne({ a : 3 }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Removed the document with the field a equal to 3"); - callback(result); - }); -} -``` - -Add the new method to the **MongoClient.connect** callback function. - -```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); - -// Connection URL -const url = 'mongodb://localhost:27017'; - -// Database Name -const dbName = 'myproject'; - -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected successfully to server"); - - const db = client.db(dbName); - - insertDocuments(db, function() { - updateDocument(db, function() { - removeDocument(db, function() { - client.close(); - }); - }); - }); -}); +const deleteResult = await collection.deleteMany({ a: 3 }) +console.log('Deleted documents =>', deleteResult) ``` ### Index a Collection @@ -443,56 +217,22 @@ performance. The following function creates an index on the **a** field in the **documents** collection. ```js -const indexCollection = function(db, callback) { - db.collection('documents').createIndex( - { "a": 1 }, - null, - function(err, results) { - console.log(results); - callback(); - } - ); -}; -``` - -Add the ``indexCollection`` method to your app: - -```js -const MongoClient = require('mongodb').MongoClient; -const assert = require('assert'); - -// Connection URL -const url = 'mongodb://localhost:27017'; - -const dbName = 'myproject'; - -// Use connect method to connect to the server -MongoClient.connect(url, function(err, client) { - assert.equal(null, err); - console.log("Connected successfully to server"); - - const db = client.db(dbName); - - insertDocuments(db, function() { - indexCollection(db, function() { - client.close(); - }); - }); -}); +const indexName = await collection.createIndex({a: 1}) +console.log('index name =', indexName) ``` -For more detailed information, see the [official documentation](https://docs.mongodb.com/drivers/node/). +For more detailed information, see the [indexing strategies page](https://docs.mongodb.com/manual/applications/indexes/). ## Next Steps - * [MongoDB Documentation](http://mongodb.org) - * [MongoDB Node Driver Offical Documentation](https://docs.mongodb.com/drivers/node/) - * [Read about Schemas](http://learnmongodbthehardway.com) - * [Star us on GitHub](https://github.com/mongodb/node-mongodb-native) +- [MongoDB Documentation](https://docs.mongodb.com/manual/) +- [MongoDB Node Driver Documentation](https://docs.mongodb.com/drivers/node/) +- [Read about Schemas](https://docs.mongodb.com/manual/core/data-modeling-introduction/) +- [Star us on GitHub](https://github.com/mongodb/node-mongodb-native) ## License [Apache 2.0](LICENSE.md) -© 2009-2012 Christian Amor Kvalheim +© 2009-2012 Christian Amor Kvalheim © 2012-present MongoDB [Contributors](CONTRIBUTORS.md) diff --git a/CHANGES_3.0.0.md b/docs/CHANGES_3.0.0.md similarity index 100% rename from CHANGES_3.0.0.md rename to docs/CHANGES_3.0.0.md diff --git a/docs/CHANGES_4.0.0.md b/docs/CHANGES_4.0.0.md new file mode 100644 index 00000000000..deae427c3ac --- /dev/null +++ b/docs/CHANGES_4.0.0.md @@ -0,0 +1,3 @@ +# Changes in 4.x + +WIP diff --git a/docs/native-extensions.md b/docs/native-extensions.md new file mode 100644 index 00000000000..e3875e8da81 --- /dev/null +++ b/docs/native-extensions.md @@ -0,0 +1,67 @@ +# Native Extensions + +The `kerberos` package is a C++ extension that requires a build environment to be installed on your system. You must be able to build Node.js itself in order to compile and install the `kerberos` module. Furthermore, the `kerberos` module requires the MIT Kerberos package to correctly compile on UNIX operating systems. Consult your UNIX operation system package manager for what libraries to install. + +**Windows already contains the SSPI API used for Kerberos authentication. However, you will need to install a full compiler tool chain using Visual Studio C++ to correctly install the Kerberos extension.** + +## Diagnosing on UNIX + +If you don’t have the build-essentials, this module won’t build. In the case of Linux, you will need gcc, g++, Node.js with all the headers and Python. The easiest way to figure out what’s missing is by trying to build the Kerberos project. You can do this by performing the following steps. + +```bash +git clone https://github.com/mongodb-js/kerberos +cd kerberos +npm install +``` + +If all the steps complete, you have the right toolchain installed. If you get the error "node-gyp not found," you need to install `node-gyp` globally: + +```bash +npm install -g node-gyp +``` + +If it correctly compiles and runs the tests you are golden. We can now try to install the `mongod` driver by performing the following command. + +```bash +cd yourproject +npm install mongodb --save +``` + +If it still fails the next step is to examine the npm log. Rerun the command but in this case in verbose mode. + +```bash +npm --loglevel verbose install mongodb +``` + +This will print out all the steps npm is performing while trying to install the module. + +## Diagnosing on Windows + +A compiler tool chain known to work for compiling `kerberos` on Windows is the following. + +- Visual Studio C++ 2010 (do not use higher versions) +- Windows 7 64bit SDK +- Python 2.7 or higher + +Open the Visual Studio command prompt. Ensure `node.exe` is in your path and install `node-gyp`. + +```bash +npm install -g node-gyp +``` + +Next, you will have to build the project manually to test it. Clone the repo, install dependencies and rebuild: + +```bash +git clone https://github.com/christkv/kerberos.git +cd kerberos +npm install +node-gyp rebuild +``` + +This should rebuild the driver successfully if you have everything set up correctly. + +## Other possible issues + +Your Python installation might be hosed making gyp break. Test your deployment environment first by trying to build Node.js itself on the server in question, as this should unearth any issues with broken packages (and there are a lot of broken packages out there). + +Another tip is to ensure your user has write permission to wherever the Node.js modules are being installed. diff --git a/package-lock.json b/package-lock.json index 369a34c4306..9d103f546f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -325,16 +325,16 @@ "dev": true }, "@microsoft/api-extractor": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.12.0.tgz", - "integrity": "sha512-YDd7AUkIayPLooMasDyV4vle1TLUQhFp2v/tGdRU+WAVbnyVUDXXa20WEfbPEZ4QVlgN+77EX6f2K6GyKd713A==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.12.1.tgz", + "integrity": "sha512-lleLrKkqiRvOQeoRMSHQY0wl/j9SxRVd9+Btyh/WWw0kHNy7nAKyzGmejvlz2XTn13H0elJWV6C3dxhaQy4mtA==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.12.0", - "@microsoft/tsdoc": "0.12.19", - "@rushstack/node-core-library": "3.35.1", - "@rushstack/rig-package": "0.2.8", - "@rushstack/ts-command-line": "4.7.7", + "@microsoft/api-extractor-model": "7.12.1", + "@microsoft/tsdoc": "0.12.24", + "@rushstack/node-core-library": "3.35.2", + "@rushstack/rig-package": "0.2.9", + "@rushstack/ts-command-line": "4.7.8", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", @@ -344,47 +344,44 @@ }, "dependencies": { "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, "@microsoft/api-extractor-model": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.12.0.tgz", - "integrity": "sha512-TxoAbL/lauS3k/brBWVsiQTnyHBwHrAGJhTuiD0tWS/eu4dLNULchcSQfcOaFS91OgDEz4lMMbClgChFuo+53Q==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.12.1.tgz", + "integrity": "sha512-Hw+kYfUb1gt6xPWGFW8APtLVWeNEWz4JE6PbLkSHw/j+G1hAaStzgxhBx3GOAWM/G0SCDGVJOpd5YheVOyu/KQ==", "dev": true, "requires": { - "@microsoft/tsdoc": "0.12.19", - "@rushstack/node-core-library": "3.35.1" + "@microsoft/tsdoc": "0.12.24", + "@rushstack/node-core-library": "3.35.2" } }, "@microsoft/tsdoc": { - "version": "0.12.19", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.12.19.tgz", - "integrity": "sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A==", + "version": "0.12.24", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.12.24.tgz", + "integrity": "sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg==", "dev": true }, "@microsoft/tsdoc-config": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.13.7.tgz", - "integrity": "sha512-JYYda/56gWeLIvJof4SaFFwVUeRvIJ+7kDIsr0GZQ7IAtk9HXqzCZRfUnZirRN0NwVPMx4IhU0RK20Wx54iefg==", + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.13.9.tgz", + "integrity": "sha512-VqqZn+rT9f6XujFPFR2aN9XKF/fuir/IzKVzoxI0vXIzxysp4ee6S2jCakmlGFHEasibifFTsJr7IYmRPxfzYw==", "dev": true, "requires": { - "@microsoft/tsdoc": "0.12.22", + "@microsoft/tsdoc": "0.12.24", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" }, "dependencies": { - "@microsoft/tsdoc": { - "version": "0.12.22", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.12.22.tgz", - "integrity": "sha512-CAHpI8CR0SaoIxDqw4BydOW9odti6AWfYYADil6/0h1TjUBNpMTrcbSVo96Kr4aiyGDHsDPmn7VRU+jfN9e7ow==", - "dev": true - }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -410,9 +407,9 @@ } }, "@rushstack/node-core-library": { - "version": "3.35.1", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.35.1.tgz", - "integrity": "sha512-ZwnXp2loZyVUgrZ+fEKKF/EHl0ikcy6SCsd34ewYXoEAs0XWIy2VS9bemrfaFtd2VzJ/G/ZbP3xHkqRnUPKJ4Q==", + "version": "3.35.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.35.2.tgz", + "integrity": "sha512-SPd0uG7mwsf3E30np9afCUhtaM1SBpibrbxOXPz82KWV6SQiPUtXeQfhXq9mSnGxOb3WLWoSDe7AFxQNex3+kQ==", "dev": true, "requires": { "@types/node": "10.17.13", @@ -433,17 +430,20 @@ "dev": true }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, "@rushstack/rig-package": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.2.8.tgz", - "integrity": "sha512-Ltjeg1a5Sx7XTW9oBxmcfhHseBLnH7I/8d6tAtjx5s0r7F6WmNVJdxVmt86qNfXcFRsiGNrzLqjMwlcX3GyldQ==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.2.9.tgz", + "integrity": "sha512-4tqsZ/m+BjeNAGeAJYzPF53CT96TsAYeZ3Pq3T4tb1pGGM3d3TWfkmALZdKNhpRlAeShKUrb/o/f/0sAuK/1VQ==", "dev": true, "requires": { "@types/node": "10.17.13", @@ -460,9 +460,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.7.7.tgz", - "integrity": "sha512-COSDys0WTVCORKam2hsTL32As4fHAf1RqC6FKS98hgR0Z90nh1JX8fGNkvSdxaZ6dOuNTJj3txh+SpWoHJoZJA==", + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.7.8.tgz", + "integrity": "sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -527,15 +527,6 @@ "@types/node": "*" } }, - "@types/bson": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.2.tgz", - "integrity": "sha512-+uWmsejEHfmSjyyM/LkrP0orfE2m5Mx9Xel4tXNeqi1ldK5XMQcDsFkBmLDtuyKUbxj2jGDo0H240fbCRJZo7Q==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -915,9 +906,9 @@ "dev": true }, "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -975,21 +966,20 @@ "dev": true }, "bson": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.1.0.tgz", - "integrity": "sha512-xwNzRRsK2xmHvHuPESi0zVfgsm4edO47WdulNaShTriunNUMRDOAlKwpJc8zpkOXczIzbxUD7kFzhUGVYoZLDw==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.2.2.tgz", + "integrity": "sha512-9fX257PVHAUpiRGmY3356RVWKQxLA73BgjA/x5MGuJkTEMeG7yzjuBrsiFB67EXRJnFVKrbJY9t/M+oElKYktQ==", "requires": { - "buffer": "^5.1.0", - "long": "^4.0.0" + "buffer": "^5.6.0" } }, "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" } }, "buffer-alloc": { @@ -1341,12 +1331,6 @@ "dot-prop": "^5.1.0" } }, - "compare-versions": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", - "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2437,21 +2421,13 @@ "dev": true }, "eslint-plugin-tsdoc": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.8.tgz", - "integrity": "sha512-gLmCo2e89JqPnULZUuqILrxZSrmlynJV441cOpn7rFbHhaa+sKi0Hbs2npAi+ijl/ljSH7GoJyBr7KAFF/JIbA==", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.10.tgz", + "integrity": "sha512-LDK6K0tQ7tIyVzyktwX7P9V/aZZOMSIGYRnDP3x6+obITkVyrCrkc5yUhBiUjTc/S9gEy5GpjwD02wgcMPBFbA==", "dev": true, "requires": { - "@microsoft/tsdoc": "0.12.22", - "@microsoft/tsdoc-config": "0.13.7" - }, - "dependencies": { - "@microsoft/tsdoc": { - "version": "0.12.22", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.12.22.tgz", - "integrity": "sha512-CAHpI8CR0SaoIxDqw4BydOW9odti6AWfYYADil6/0h1TjUBNpMTrcbSVo96Kr4aiyGDHsDPmn7VRU+jfN9e7ow==", - "dev": true - } + "@microsoft/tsdoc": "0.12.24", + "@microsoft/tsdoc-config": "0.13.9" } }, "eslint-scope": { @@ -3528,12 +3504,6 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "highlight.js": { - "version": "10.3.2", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.3.2.tgz", - "integrity": "sha512-3jRT7OUYsVsKvukNKZCtnvRcFyCJqSEIuIMsEybAXRiFSwpt65qjPd/Pr+UOdYt7WJlt+lj3+ypUsHiySBp/Jw==", - "dev": true - }, "hosted-git-info": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", @@ -3567,9 +3537,9 @@ } }, "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "4.0.6", @@ -4440,11 +4410,6 @@ "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", "dev": true }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -4455,6 +4420,15 @@ "signal-exit": "^3.0.0" } }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -5410,6 +5384,32 @@ "mimic-fn": "^2.1.0" } }, + "onigasm": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", + "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", + "dev": true, + "requires": { + "lru-cache": "^5.1.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -6360,6 +6360,37 @@ "rechoir": "^0.6.2" } }, + "shiki": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.2.7.tgz", + "integrity": "sha512-bwVc7cdtYYHEO9O+XJ8aNOskKRfaQd5Y4ovLRfbQkmiLSUaR+bdlssbZUUhbQ0JAFMYcTcJ5tjG5KtnufttDHQ==", + "dev": true, + "requires": { + "onigasm": "^2.2.5", + "shiki-languages": "^0.2.7", + "shiki-themes": "^0.2.7", + "vscode-textmate": "^5.2.0" + } + }, + "shiki-languages": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/shiki-languages/-/shiki-languages-0.2.7.tgz", + "integrity": "sha512-REmakh7pn2jCn9GDMRSK36oDgqhh+rSvJPo77sdWTOmk44C5b0XlYPwJZcFOMJWUZJE0c7FCbKclw4FLwUKLRw==", + "dev": true, + "requires": { + "vscode-textmate": "^5.2.0" + } + }, + "shiki-themes": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/shiki-themes/-/shiki-themes-0.2.7.tgz", + "integrity": "sha512-ZMmboDYw5+SEpugM8KGUq3tkZ0vXg+k60XX6NngDK7gc1Sv6YLUlanpvG3evm57uKJvfXsky/S5MzSOTtYKLjA==", + "dev": true, + "requires": { + "json5": "^2.1.0", + "vscode-textmate": "^5.2.0" + } + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -7219,24 +7250,30 @@ } }, "typedoc": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.19.2.tgz", - "integrity": "sha512-oDEg1BLEzi1qvgdQXc658EYgJ5qJLVSeZ0hQ57Eq4JXy6Vj2VX4RVo18qYxRWz75ifAaYuYNBUCnbhjd37TfOg==", + "version": "0.20.14", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.14.tgz", + "integrity": "sha512-9bsZp5/qkl+gDSv9DRvHbfbY8Sr0tD8fKx7hNIvcluxeAFzBCEo9o0qDCdLUZw+/axbfd9TaqHvSuCVRu+YH6Q==", "dev": true, "requires": { + "colors": "^1.4.0", "fs-extra": "^9.0.1", "handlebars": "^4.7.6", - "highlight.js": "^10.2.0", "lodash": "^4.17.20", "lunr": "^2.3.9", - "marked": "^1.1.1", + "marked": "^1.2.5", "minimatch": "^3.0.0", "progress": "^2.0.3", - "semver": "^7.3.2", "shelljs": "^0.8.4", - "typedoc-default-themes": "^0.11.4" + "shiki": "^0.2.7", + "typedoc-default-themes": "0.12.1" }, "dependencies": { + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, "fs-extra": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", @@ -7268,21 +7305,15 @@ } }, "marked": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.4.tgz", - "integrity": "sha512-6x5TFGCTKSQBLTZtOburGxCxFEBJEGYVLwCMTBCxzvyuisGcC20UNzDSJhCr/cJ/Kmh6ulfJm10g6WWEAJ3kvg==", - "dev": true - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.7.tgz", + "integrity": "sha512-No11hFYcXr/zkBvL6qFmAp1z6BKY3zqLMHny/JN/ey+al7qwCM2+CMBL9BOgqMxZU36fz4cCWfn2poWIf7QRXA==", "dev": true }, "typedoc-default-themes": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.11.4.tgz", - "integrity": "sha512-Y4Lf+qIb9NTydrexlazAM46SSLrmrQRqWiD52593g53SsmUFioAsMWt8m834J6qsp+7wHRjxCXSZeiiW5cMUdw==", + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.1.tgz", + "integrity": "sha512-6PEvV+/kWAJeUwEtrKgIsZQSbybW5DGCr6s2mMjHsDplpgN8iBHI52UbA+2C+c2TMCxBNMK9TMS6pdeIdwsLSw==", "dev": true }, "universalify": { @@ -7293,25 +7324,6 @@ } } }, - "typedoc-default-themes": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.10.2.tgz", - "integrity": "sha512-zo09yRj+xwLFE3hyhJeVHWRSPuKEIAsFK5r2u47KL/HBKqpwdUSanoaz5L34IKiSATFrjG5ywmIu98hPVMfxZg==", - "dev": true, - "requires": { - "lunr": "^2.3.8" - } - }, - "typedoc-plugin-pages": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/typedoc-plugin-pages/-/typedoc-plugin-pages-1.1.0.tgz", - "integrity": "sha512-pmCCp3G2aCeEWb829dcVe9Pl+pI5OsaqfyrkEutcAHZi6IMVfQ5G5NdrkIkFCGhJU/DY04rGrVdynWqnaO5/jg==", - "dev": true, - "requires": { - "compare-versions": "^3.6.0", - "typedoc-default-themes": "^0.10.1" - } - }, "typescript": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", @@ -7433,6 +7445,12 @@ "extsprintf": "^1.2.0" } }, + "vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "dev": true + }, "walkdir": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz", @@ -7635,6 +7653,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "14.2.3", "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", diff --git a/package.json b/package.json index 3d88bc02d74..0d6dfb9d52a 100644 --- a/package.json +++ b/package.json @@ -21,21 +21,19 @@ "peerOptionalDependencies": { "kerberos": "^1.1.0", "mongodb-client-encryption": "^1.0.0", - "mongodb-extjson": "^2.1.2", "snappy": "^6.1.1", "bson-ext": "^2.0.0" }, "dependencies": { - "bson": "^4.0.4", + "bson": "^4.2.2", "denque": "^1.4.1" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@microsoft/api-extractor": "^7.12.0", - "@microsoft/tsdoc-config": "^0.13.7", + "@microsoft/api-extractor": "^7.12.1", + "@microsoft/tsdoc-config": "^0.13.9", "@types/aws4": "^1.5.1", "@types/bl": "^2.1.0", - "@types/bson": "^4.0.2", "@types/kerberos": "^1.1.0", "@types/mocha": "^8.2.0", "@types/node": "^14.6.4", @@ -52,7 +50,7 @@ "eslint-plugin-jsdoc": "^30.7.8", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-tsdoc": "^0.2.8", + "eslint-plugin-tsdoc": "^0.2.10", "js-yaml": "^3.14.0", "jsdoc": "^3.6.4", "lodash.camelcase": "^4.3.0", @@ -71,8 +69,7 @@ "standard-version": "^7.1.0", "through2": "^3.0.1", "ts-node": "^9.0.0", - "typedoc": "^0.19.2", - "typedoc-plugin-pages": "^1.1.0", + "typedoc": "^0.20.14", "typescript": "^4.0.5", "typescript-cached-transpile": "^0.0.6", "worker-farm": "^1.5.0", @@ -91,7 +88,7 @@ "build:evergreen": "node .evergreen/generate_evergreen_tasks.js", "build:ts": "rimraf lib && tsc", "build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'", - "build:docs": "npm run build:dts && typedoc", + "build:docs": "typedoc", "check:bench": "node test/benchmarks/driverBench", "check:coverage": "nyc npm run check:test", "check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint", diff --git a/src/bson.ts b/src/bson.ts index c7b8fa6274f..03266cbfaeb 100644 --- a/src/bson.ts +++ b/src/bson.ts @@ -19,6 +19,9 @@ export { Int32, Double, DBRef, + BSONRegExp, + BSONSymbol, + Map, deserialize, serialize, calculateObjectSize diff --git a/src/index.ts b/src/index.ts index 62ab65cac29..c4ec7cf7154 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,20 +39,11 @@ export { MaxKey, ObjectId, Timestamp, - Decimal128 + Decimal128, + BSONRegExp, + BSONSymbol } from './bson'; -// NOTE: fix this up after ts-bson lands -/** @public */ -// eslint-disable-next-line @typescript-eslint/no-var-requires -export const Map = require('bson').Map; -/** @public */ -// eslint-disable-next-line @typescript-eslint/no-var-requires -export const BSONSymbol = require('bson').BSONSymbol; -/** @public */ -// eslint-disable-next-line @typescript-eslint/no-var-requires -export const BSONRegExp = require('bson').BSONRegExp; - export { MongoError, MongoNetworkError, diff --git a/typedoc.json b/typedoc.json index 6d30bdae839..09825c4cb0b 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,75 +1,34 @@ { - "entryPoint": "types/mongodb.d.ts", - "mode": "file", - "out": "docs/public", - "theme": "pages-plugin", - "excludeNotExported": true, - "stripInternal": true, - "pages": { - "enableSearch": true, - "listInvalidSymbolLinks": true, - "output": "pages", - "groups": [ - { - "title": "Documentation", - "pages": [ - { - "title": "FAQ", - "source": "docs/reference/content/reference/faq/index.md" - } - ] - }, - { - "title": "Tutorials", - "pages": [ - { - "title": "Quick Start", - "source": "docs/reference/content/quick-start/quick-start.md", - "children": [ - { - "title": "aggregation", - "source": "docs/reference/content/tutorials/aggregation.md" - }, - { - "title": "collations", - "source": "docs/reference/content/tutorials/collations.md" - }, - { - "title": "collections", - "source": "docs/reference/content/tutorials/collections.md" - }, - { - "title": "commands", - "source": "docs/reference/content/tutorials/commands.md" - }, - { - "title": "create-indexes", - "source": "docs/reference/content/tutorials/create-indexes.md" - }, - { - "title": "crud", - "source": "docs/reference/content/tutorials/crud.md" - }, - { - "title": "geospatial-search", - "source": "docs/reference/content/tutorials/geospatial-search.md" - }, - { - "title": "main", - "source": "docs/reference/content/tutorials/main.md" - }, - { - "title": "projections", - "source": "docs/reference/content/tutorials/projections.md" - }, - { - "title": "text-search", - "source": "docs/reference/content/tutorials/text-search.md" - } - ] - } - ] - } - ] - } + "entryPoints": [ + "src/index.ts" + ], + "toc": [ + "Admin", + "AggregationCursor", + "Binary", + "BSONRegExp", + "ChangeStream", + "Code", + "Collection", + "Db", + "Decimal128", + "Double", + "FindCursor", + "GridFSBucket", + "Int32", + "Long", + "MongoClient", + "MongoClientOptions", + "MongoError", + "MongoNetworkError", + "MongoParseError", + "MongoServerSelectionError", + "MongoTimeoutError", + "MongoWriteConcernError", + "ObjectId", + "ReadConcern", + "ReadPreference", + "WriteConcern" + ], + "out": "docs/public" }