-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
196 lines (196 loc) · 20.4 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{
"_args": [
[
{
"raw": "mongodb@^3.1.13",
"scope": null,
"escapedName": "mongodb",
"name": "mongodb",
"rawSpec": "^3.1.13",
"spec": ">=3.1.13 <4.0.0",
"type": "range"
},
"/home/vagrant/app/app/app/app"
]
],
"_from": "mongodb@>=3.1.13 <4.0.0",
"_hasShrinkwrap": false,
"_id": "mongodb@3.7.3",
"_inCache": true,
"_location": "/mongodb",
"_nodeVersion": "14.17.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/mongodb_3.7.3_1634751482284_0.11847914648019642"
},
"_npmUser": {
"name": "nbbeeken",
"email": "neal.beeken@mongodb.com"
},
"_npmVersion": "7.22.0",
"_phantomChildren": {},
"_requested": {
"raw": "mongodb@^3.1.13",
"scope": null,
"escapedName": "mongodb",
"name": "mongodb",
"rawSpec": "^3.1.13",
"spec": ">=3.1.13 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/",
"/mongoose",
"/node-mongo-seeds"
],
"_resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.7.3.tgz",
"_shasum": "b7949cfd0adc4cc7d32d3f2034214d4475f175a5",
"_shrinkwrap": null,
"_spec": "mongodb@^3.1.13",
"_where": "/home/vagrant/app/app/app/app",
"author": {
"name": "The MongoDB NodeJS Team",
"email": "dbx-node@mongodb.com"
},
"bugs": {
"url": "https://jira.mongodb.org/projects/NODE/issues/"
},
"dependencies": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"optional-require": "^1.1.8",
"safe-buffer": "^5.1.2",
"saslprep": "^1.0.0"
},
"description": "The official MongoDB driver for Node.js",
"devDependencies": {
"@types/chai": "^4.2.16",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.37",
"array-includes": "^3.1.3",
"chai": "^4.1.1",
"chai-subset": "^1.6.0",
"chalk": "^2.4.2",
"co": "4.6.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-es": "^3.0.1",
"eslint-plugin-prettier": "^3.1.3",
"jsdoc": "^3.5.5",
"lodash.camelcase": "^4.3.0",
"mocha": "5.2.0",
"mocha-sinon": "^2.1.0",
"mongodb-extjson": "^2.1.1",
"mongodb-mock-server": "^1.0.1",
"nyc": "^15.1.0",
"object.entries": "^1.1.3",
"prettier": "^1.19.1",
"semver": "^5.5.0",
"sinon": "^4.3.0",
"sinon-chai": "^3.2.0",
"snappy": "^6.3.4",
"spec-xunit-file": "0.0.1-3",
"standard-version": "^9.2.0",
"tslib": "^2.2.0",
"typescript": "^4.2.4",
"util.promisify": "^1.0.1",
"worker-farm": "^1.5.0",
"wtfnode": "^0.8.0",
"yargs": "^14.2.0"
},
"directories": {},
"dist": {
"integrity": "sha512-Psm+g3/wHXhjBEktkxXsFMZvd3nemI0r3IPsE0bU+4//PnvNWKkzhZcEsbPcYiWqe8XqXJJEg4Tgtr7Raw67Yw==",
"shasum": "b7949cfd0adc4cc7d32d3f2034214d4475f175a5",
"tarball": "https://registry.npmjs.org/mongodb/-/mongodb-3.7.3.tgz",
"fileCount": 150,
"unpackedSize": 1355769,
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEQCIDpSn1/dVQi8OdbQdF8533Rd7Qr681j2wNLOKDPzFrsNAiA/OR0RTJm+lt0n+HVSIgKWZWt97MNrSIlbyF0K7wK6Tg=="
}
]
},
"engines": {
"node": ">=4"
},
"gitHead": "b42e8b369a8af8f21877bfaaf55d09ee9d9ee976",
"homepage": "https://github.com/mongodb/node-mongodb-native",
"keywords": [
"mongodb",
"driver",
"official"
],
"license": "Apache-2.0",
"main": "index.js",
"maintainers": [
{
"name": "mbroadst",
"email": "mbroadst@gmail.com"
},
{
"name": "durran",
"email": "durran@gmail.com"
},
{
"name": "nbbeeken",
"email": "neal.beeken@mongodb.com"
},
{
"name": "kmahar",
"email": "kaitlin.mahar@mongodb.com"
},
{
"name": "dariakp",
"email": "daria.pardue@mongodb.com"
}
],
"name": "mongodb",
"optionalDependencies": {
"saslprep": "^1.0.0"
},
"peerDependenciesMeta": {
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"mongodb-extjson": {
"optional": true
},
"snappy": {
"optional": true
},
"bson-ext": {
"optional": true
},
"aws4": {
"optional": true
}
},
"readme": "# MongoDB NodeJS Driver\n\n[![npm](https://nodei.co/npm/mongodb.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mongodb/)\n\nThe official [MongoDB](https://www.mongodb.com/) driver for Node.js.\n\n**NOTE: v3.x released with breaking API changes. You can find a list of changes [here](CHANGES_3.0.0.md).**\n\n## Version 4.0\n\n**Looking for the latest?** We're working on the next major version of the driver, now in beta.\nCheck out our [beta version 4.0 here](https://github.com/mongodb/node-mongodb-native/tree/4.0), which includes a full migration of the driver to TypeScript.\n\n## Quick Links\n\n| what | where |\n| ------------- | ---------------------------------------------------- |\n| documentation | https://mongodb.github.io/node-mongodb-native |\n| api-doc | https://mongodb.github.io/node-mongodb-native/3.6/api |\n| source | https://github.com/mongodb/node-mongodb-native |\n| mongodb | https://www.mongodb.org |\n\n### Bugs / Feature Requests\n\nThink you’ve found a bug? Want to see a new feature in `node-mongodb-native`? Please open a\ncase in our issue management tool, JIRA:\n\n- Create an account and login [jira.mongodb.org](https://jira.mongodb.org).\n- Navigate to the NODE project [jira.mongodb.org/browse/NODE](https://jira.mongodb.org/browse/NODE).\n- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.\n\nBug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the\nCore Server (i.e. SERVER) project are **public**.\n\n### Support / Feedback\n\nFor issues with, questions about, or feedback for the Node.js driver, please look into our [support channels](https://docs.mongodb.com/manual/support). Please do not email any of the driver developers directly with issues or questions - you're more likely to get an answer on the [MongoDB Community Forums](https://community.mongodb.com/tags/c/drivers-odms-connectors/7/node-js-driver).\n\n### Change Log\n\nChange history can be found in [`HISTORY.md`](HISTORY.md).\n\n### Compatibility\n\nFor version compatibility matrices, please refer to the following links:\n\n- [MongoDB](https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#reference-compatibility-mongodb-node)\n- [NodeJS](https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#reference-compatibility-language-node)\n\n## Installation\n\nThe recommended way to get started using the Node.js driver is by using `npm` (Node Package Manager) to install the dependency in your project.\n\n## MongoDB Driver\n\nGiven that you have created your own project using `npm init` we install the MongoDB driver and its dependencies by executing the following `npm` command.\n\n```bash\nnpm install mongodb --save\n```\n\nThis will download the MongoDB driver and add a dependency entry in your `package.json` file.\n\nYou can also use the [Yarn](https://yarnpkg.com/en) package manager.\n\n## Troubleshooting\n\nThe MongoDB driver depends on several other packages. These are:\n\n- [bson](https://github.com/mongodb/js-bson)\n- [bson-ext](https://github.com/mongodb-js/bson-ext)\n- [kerberos](https://github.com/mongodb-js/kerberos)\n- [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme)\n\nThe `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.\n\n**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.**\n\n### Diagnosing on UNIX\n\nIf 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.\n\n```bash\ngit clone https://github.com/mongodb-js/kerberos\ncd kerberos\nnpm install\n```\n\nIf 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:\n\n```bash\nnpm install -g node-gyp\n```\n\nIf it correctly compiles and runs the tests you are golden. We can now try to install the `mongod` driver by performing the following command.\n\n```bash\ncd yourproject\nnpm install mongodb --save\n```\n\nIf it still fails the next step is to examine the npm log. Rerun the command but in this case in verbose mode.\n\n```bash\nnpm --loglevel verbose install mongodb\n```\n\nThis will print out all the steps npm is performing while trying to install the module.\n\n### Diagnosing on Windows\n\nA compiler tool chain known to work for compiling `kerberos` on Windows is the following.\n\n- Visual Studio C++ 2010 (do not use higher versions)\n- Windows 7 64bit SDK\n- Python 2.7 or higher\n\nOpen the Visual Studio command prompt. Ensure `node.exe` is in your path and install `node-gyp`.\n\n```bash\nnpm install -g node-gyp\n```\n\nNext, you will have to build the project manually to test it. Clone the repo, install dependencies and rebuild:\n\n```bash\ngit clone https://github.com/christkv/kerberos.git\ncd kerberos\nnpm install\nnode-gyp rebuild\n```\n\nThis should rebuild the driver successfully if you have everything set up correctly.\n\n### Other possible issues\n\nYour 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).\n\nAnother tip is to ensure your user has write permission to wherever the Node.js modules are being installed.\n\n## Quick Start\n\nThis guide will show you how to set up a simple application using Node.js and MongoDB. Its scope is only how to set up the driver and perform the simple CRUD operations. For more in-depth coverage, see the [tutorials](docs/reference/content/tutorials/main.md).\n\n### Create the `package.json` file\n\nFirst, create a directory where your application will live.\n\n```bash\nmkdir myproject\ncd myproject\n```\n\nEnter the following command and answer the questions to create the initial structure for your new project:\n\n```bash\nnpm init\n```\n\nNext, install the driver dependency.\n\n```bash\nnpm install mongodb --save\n```\n\nYou should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory.\n\n### Start a MongoDB Server\n\nFor complete MongoDB installation instructions, see [the manual](https://docs.mongodb.org/manual/installation/).\n\n1. Download the right MongoDB version from [MongoDB](https://www.mongodb.org/downloads)\n2. Create a database directory (in this case under **/data**).\n3. Install and start a `mongod` process.\n\n```bash\nmongod --dbpath=/data\n```\n\nYou should see the **mongod** process start up and print some status information.\n\n### Connect to MongoDB\n\nCreate a new **app.js** file and add the following code to try out some basic CRUD\noperations using the MongoDB driver.\n\nAdd code to connect to the server and the database **myproject**:\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\n// Database Name\nconst dbName = 'myproject';\nconst client = new MongoClient(url);\n// Use connect method to connect to the server\nclient.connect(function(err) {\n assert.equal(null, err);\n console.log('Connected successfully to server');\n\n const db = client.db(dbName);\n\n client.close();\n});\n```\n\nRun your app from the command line with:\n\n```bash\nnode app.js\n```\n\nThe application should print **Connected successfully to server** to the console.\n\n### Insert a Document\n\nAdd to **app.js** the following function which uses the **insertMany**\nmethod to add three documents to the **documents** collection.\n\n```js\nconst insertDocuments = function(db, callback) {\n // Get the documents collection\n const collection = db.collection('documents');\n // Insert some documents\n collection.insertMany([{ a: 1 }, { a: 2 }, { a: 3 }], function(err, result) {\n assert.equal(err, null);\n assert.equal(3, result.result.n);\n assert.equal(3, result.ops.length);\n console.log('Inserted 3 documents into the collection');\n callback(result);\n });\n};\n```\n\nThe **insert** command returns an object with the following fields:\n\n- **result** Contains the result document from MongoDB\n- **ops** Contains the documents inserted with added **\\_id** fields\n- **connection** Contains the connection used to perform the insert\n\nAdd the following code to call the **insertDocuments** function:\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\n// Database Name\nconst dbName = 'myproject';\n\n// Use connect method to connect to the server\nMongoClient.connect(url, function(err, client) {\n assert.equal(null, err);\n console.log('Connected successfully to server');\n\n const db = client.db(dbName);\n\n insertDocuments(db, function() {\n client.close();\n });\n});\n```\n\nRun the updated **app.js** file:\n\n```bash\nnode app.js\n```\n\nThe operation returns the following output:\n\n```bash\nConnected successfully to server\nInserted 3 documents into the collection\n```\n\n### Find All Documents\n\nAdd a query that returns all the documents.\n\n```js\nconst findDocuments = function(db, callback) {\n // Get the documents collection\n const collection = db.collection('documents');\n // Find some documents\n collection.find({}).toArray(function(err, docs) {\n assert.equal(err, null);\n console.log('Found the following records');\n console.log(docs);\n callback(docs);\n });\n};\n```\n\nThis query returns all the documents in the **documents** collection. Add the **findDocument** method to the **MongoClient.connect** callback:\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\n// Database Name\nconst dbName = 'myproject';\n\n// Use connect method to connect to the server\nMongoClient.connect(url, function(err, client) {\n assert.equal(null, err);\n console.log('Connected correctly to server');\n\n const db = client.db(dbName);\n\n insertDocuments(db, function() {\n findDocuments(db, function() {\n client.close();\n });\n });\n});\n```\n\n### Find Documents with a Query Filter\n\nAdd a query filter to find only documents which meet the query criteria.\n\n```js\nconst findDocuments = function(db, callback) {\n // Get the documents collection\n const collection = db.collection('documents');\n // Find some documents\n collection.find({ a: 3 }).toArray(function(err, docs) {\n assert.equal(err, null);\n console.log('Found the following records');\n console.log(docs);\n callback(docs);\n });\n};\n```\n\nOnly the documents which match `'a' : 3` should be returned.\n\n### Update a document\n\nThe following operation updates a document in the **documents** collection.\n\n```js\nconst updateDocument = function(db, callback) {\n // Get the documents collection\n const collection = db.collection('documents');\n // Update document where a is 2, set b equal to 1\n collection.updateOne({ a: 2 }, { $set: { b: 1 } }, function(err, result) {\n assert.equal(err, null);\n assert.equal(1, result.result.n);\n console.log('Updated the document with the field a equal to 2');\n callback(result);\n });\n};\n```\n\nThe 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.\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\n// Database Name\nconst dbName = 'myproject';\n\n// Use connect method to connect to the server\nMongoClient.connect(url, function(err, client) {\n assert.equal(null, err);\n console.log('Connected successfully to server');\n\n const db = client.db(dbName);\n\n insertDocuments(db, function() {\n updateDocument(db, function() {\n client.close();\n });\n });\n});\n```\n\n### Remove a document\n\nRemove the document where the field **a** is equal to **3**.\n\n```js\nconst removeDocument = function(db, callback) {\n // Get the documents collection\n const collection = db.collection('documents');\n // Delete document where a is 3\n collection.deleteOne({ a: 3 }, function(err, result) {\n assert.equal(err, null);\n assert.equal(1, result.result.n);\n console.log('Removed the document with the field a equal to 3');\n callback(result);\n });\n};\n```\n\nAdd the new method to the **MongoClient.connect** callback function.\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\n// Database Name\nconst dbName = 'myproject';\n\n// Use connect method to connect to the server\nMongoClient.connect(url, function(err, client) {\n assert.equal(null, err);\n console.log('Connected successfully to server');\n\n const db = client.db(dbName);\n\n insertDocuments(db, function() {\n updateDocument(db, function() {\n removeDocument(db, function() {\n client.close();\n });\n });\n });\n});\n```\n\n### Index a Collection\n\n[Indexes](https://docs.mongodb.org/manual/indexes/) can improve your application's\nperformance. The following function creates an index on the **a** field in the\n**documents** collection.\n\n```js\nconst indexCollection = function(db, callback) {\n db.collection('documents').createIndex({ a: 1 }, null, function(err, results) {\n console.log(results);\n callback();\n });\n};\n```\n\nAdd the `indexCollection` method to your app:\n\n```js\nconst MongoClient = require('mongodb').MongoClient;\nconst assert = require('assert');\n\n// Connection URL\nconst url = 'mongodb://localhost:27017';\n\nconst dbName = 'myproject';\n\n// Use connect method to connect to the server\nMongoClient.connect(url, function(err, client) {\n assert.equal(null, err);\n console.log('Connected successfully to server');\n\n const db = client.db(dbName);\n\n insertDocuments(db, function() {\n indexCollection(db, function() {\n client.close();\n });\n });\n});\n```\n\nFor more detailed information, see the [tutorials](docs/reference/content/tutorials/main.md).\n\n## Next Steps\n\n- [MongoDB Documentation](https://mongodb.org)\n- [Read about Schemas](http://learnmongodbthehardway.com)\n- [Star us on GitHub](https://github.com/mongodb/node-mongodb-native)\n\n## License\n\n[Apache 2.0](LICENSE.md)\n\n© 2009-2012 Christian Amor Kvalheim\n© 2012-present MongoDB [Contributors](CONTRIBUTORS.md)\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/mongodb/node-mongodb-native.git"
},
"scripts": {
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
"build:unified": "tsc -p test/functional/unified-spec-runner/tsconfig.unified.json",
"check:atlas": "mocha --opts '{}' ./test/manual/atlas_connectivity.test.js",
"check:bench": "node test/benchmarks/driverBench/",
"check:coverage": "nyc npm run check:test",
"check:kerberos": "mocha --opts '{}' -t 60000 test/manual/kerberos.test.js",
"check:ldap": "mocha --opts '{}' test/manual/ldap.test.js",
"check:lint": "eslint -v && eslint lib test",
"check:test": "mocha --recursive test/functional test/unit",
"check:tls": "mocha --opts '{}' test/manual/tls_support.test.js",
"format": "npm run check:lint -- --fix",
"release": "standard-version -i HISTORY.md",
"test": "npm run check:lint && mocha --recursive test/functional test/unit"
},
"version": "3.7.3"
}