The main purpose of the MongoDB connection model is to be a domain model around a MongoDB connection. It encapsulates generating a Connection String URI from a group of attributes and parses URI using the MongoDB Node.JS Driver URI Parser.
MongoDB connection model is based on Ampersand.js framework and consist of props and derived props. The props object describes the observable properties that MongoDB connection model gets from the Node.js Driver API.
Specifies the name of the replica set, if the mongod is a member of a replica set
undefined
connectTimeoutMS
Number
The time in milliseconds to attempt a connection before timing out
undefined
socketTimeoutMS
Number
The time in milliseconds to attempt a send or receive on a socket before the attempt times out
undefined
compression
Object
Object includes compressors and a compression level. The following compressors can be specified: snappy, zlib (Available in MongoDB 3.6 or greater)
undefined
Connection Pool Option
Property
Type
Description
Default
maxPoolSize
Number
The maximum number of connections in the connection pool
undefined
minPoolSize
Number
The minimum number of connections in the connection pool
undefined
maxIdleTimeMS
Number
The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed
undefined
waitQueueMultiple
Number
A number that the driver multiples the maxPoolSize value to, to provide the maximum number of threads allowed to wait for a connection to become available from the pool
undefined
waitQueueTimeoutMS
Number
The maximum time in milliseconds that a thread can wait for a connection to become available
Specifies the read preferences for this connection. Possible values: PRIMARY, PRIMARY_PREFERRED, SECONDARY, SECONDARY_PREFERRED, NEAREST
PRIMARY
maxStalenessSeconds
Number
Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations
undefined
readPreferenceTags
Object
Default read preference tags for the client
undefined
Authentication Options
Property
Type
Description
Default
authSource
String
Specify the database name associated with the user’s credentials
undefined
authMechanism
String
Specifies the authentication mechanism that MongoDB will use to authenticate the connection. Possible values: DEFAULT, GSSAPI, MONGODB-X509, PLAIN, SCRAM-SHA-256
undefined
authMechanismProperties
Object
Additional options provided for authentication (e.g. to enable hostname canonicalization for GSSAPI)
undefined
gssapiServiceName
String
Set the Kerberos service name when connecting to Kerberized MongoDB instances
undefined
gssapiServiceRealm
String
Set the Realm service name
undefined
gssapiCanonicalizeHostName
Boolean
Whether canonicalized hostname
undefined
Server Selection and Discovery Options
Property
Type
Description
Default
localThresholdMS
Number
The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances
undefined
serverSelectionTimeoutMS
Number
Specifies how long (in milliseconds) to block for server selection before throwing an exception
undefined
serverSelectionTryOnce
Boolean
Instructs the driver to scan the MongoDB deployment exactly once after server selection fails and then either select a server or raise an error
undefined
heartbeatFrequencyMS
Number
Controls when the driver checks the state of the MongoDB deployment
undefined
Miscellaneous Configuration
Property
Type
Description
Default
appname
String
An application name passed to server as client metadata
undefined
retryWrites
Boolean
Enable retryable writes
undefined
uuidRepresentation
String
The legacy representation of UUID. Possible values: standard, csharpLegacy, javaLegacy, pythonLegacy
UNVALIDATED - Use SSL but do not perform any validation of the certificate chain. See also node.js driver "No Certificate Validation" docs. Very not recommended and likely to be deprecated in future releases because it exposes potential Man-In-The-Middle attack vectors.
Because authentication is quite difficult for operators to migrate to, the most common method of securing a MongoDB deployment is to use an SSH tunnel. This allows operators to leverage their existing SSH security infrastructure to also provide secure access to MongoDB. For a standard deployment of MongoDB on AWS, this is almost always to strategy. Because of this, we now support creating SSH tunnels automatically when connecting to MongoDB.
The above provides the same functionality as creating the tunnel using the bash
command below and connecting to MongoDB via another terminal. Notice that
connection-model uses a random local port each time it creates a tunnel.
Using the command line, you'd have to replace <random port> with an actual
port number.
Hi,
Thank you for your help in advance. In my app.js I wrote a function to read data from a remote MongoDB on AWS for index.html. When I first run node app.js it works fine and the console returnsstatus: { message: 'Validate', complete: true } status: { message: 'Load SSL files', pending: true } status: { message: 'Load SSL files', skipped: true, reason: 'The selected SSL mode does not need to load any files.' } status: { message: 'Create SSH Tunnel', pending: true } status: { message: 'Create SSH Tunnel', complete: true } status: { message: 'Connect to MongoDB', pending: true } status: { message: 'Connect to MongoDB', complete: true }
Then I try to open localhost:4000 (I set the port 4000 to listen in app.js) then there is an error my appication\node_modules\mongodb-connection-model\lib\connect.js:284 throw err; ^ Error: Error creating SSH Tunnel: Local port 29580 (chosen randomly) is already in use. You can click connect to try again with a different port. at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at doListen (net.js:1501:7) at _combinedTickCallback (internal/process/next_tick.js:141:11)
I am not sure whether I successfully connected to that or not? Although the command works fine by equal ssh command.
This version is covered by your current version range and after updating it in your project the build failed.
As pre-commit is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As async is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As mongodb is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As lodash is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As async is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As mongodb is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
Commits
The new version differs by 11 commits .
adbebcaUpdated package, history and installation guide
537a5c4Expose parserType as property on topology objects
b034c83NODE-889 Fixed issue where legacy killcursor wire protocol messages would not be sent when APM is enableD
This version is covered by your current version range and after updating it in your project the build failed.
As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As mongodb is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
Commits
The new version differs by 17 commits .
47e519fsome fixes for proxy tests to attempt to avoid travis running issues
671f286Merge branch '2.2' of github.com:mongodb/node-mongodb-native into 2.2
2603748updated history and package.json to V2.2.23
941417eMerge pull request #1470 from ra4king/patch-1
dac57e9Merge pull request #1477 from oBusk/patch-1
a24c252Merge pull request #1476 from maicss/patch-1
This version is covered by your current version range and after updating it in your project the build failed.
As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
We are attempting to access a mongo DB via a shell as shown in your example. We are getting an error when trying to connect with the following options:
One of the concerns that I see is that thought the port in options is defined as 27017 each time I attempt to call the connect function a different port is used. (ie: 29464 as shown above). I believe that this may be the root to the problem but unsure how to resolve. Additionally we never get to the db calls that are being used. Any ideas what could be going wrong here?
This version is covered by your current version range and after updating it in your project the build failed.
As mongodb is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
This version is covered by your current version range and after updating it in your project the build failed.
As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
Status Details
❌ continuous-integration/travis-ci/push The Travis CI build failed Details
Under the foundation, all contributors to Mocha must sign the JS Foundation CLA before their code can be merged. When sending a PR--if you have not already signed the CLA--a friendly bot will ask you to do so.