Skip to content

p-mongo/mongodb-faq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

MongoDB FAQ

Deployment / Configuration

Replica Set Node Reachability

Every node in the replica set must be reachable from every other node and from the client. This means:

The hostnames specified in the replica set configuration take precedence over hostnames specified in the URI/when the client is instantiated. Meaning, the client must be able to reach all of the replica set nodes using the hostnames in the replica set configuration.

Replica Set Nodes Behind NAT

A replica set node generally cannot be behind NAT (network address translation). For example, it is generally not possible to have a replica set with one node in a data center (or otherwise somewhere on the internet) and another node on one's home network.

Server Log

Where to find server log

Connectivity

General Connectivity Troubleshooting

  • Get the connection working with mongo shell before trying to connect through your application/using a driver.
  • Review the server logs (mongod.log etc.). Depending on the failure they may have important cues.

On-Premise Server Connectivity Troubleshooting

This section applies when you are running mongod yourself.

  • If your database and your application are not on the same machine, ensure bindIp is appropriately set.
  • If you are connecting to a replica set, both the hostnames/IP addresses that are specified in the seed list AND the hostnames/IP addresses that are specified in replica set configuration must be resolvable and accessible from the client. The client uses the seed list to discover nodes that are part of the replica set, from that point forward the client uses hostnames that are provided in the replica set configuration and not the seed addresses.
  • Get a standalone connection working before troubleshooting connection to a replica set.
  • Get the connectivity working when you are running the database locally prior to trying to run the database on a remote server/in the cloud.

Atlas Connectivity Troubleshooting

mongo Shell Does Not Wait For Deployment

Unlike drivers, mongo shell does not wait for deployment to become available and will immediately exit with an error if the deployment is starting up.

Answer

Node Driver & queryTxt ETIMEOUT

DNS resolution of TXT records appears to be broken on your machine. You can use the non-SRV URI to connect to your Atlas deployment instead.

Answer

Client Connects Asynchronously

Drivers establish connections to the database in the background. A successful client object instantiation does not mean the client successfully connected to the deployment.

Answer

Asking on Stack Overflow

If you are asking a connectivity-related question on Stack Overflow, collect and include in your question all of the following information:

  • The server version you are connecting to.
  • The mongo shell version (can differ from server version), if you are asking about connectivity via the shell.
  • The MongoDB driver you are using and driver version, if you are asking about connectivity via the driver
  • The exact and complete error message you have received.
  • Any relevant information from the server log(s).

Operation

Transaction Support

Transactions require:

  • For replica set deployments: MongoDB 4.0+
  • For sharded cluster deployments: MongoDB 4.2+
  • WiredTiger storage engine

Not supported:

  • Standalone servers (of any version)
  • Deployments using MMAPv1 storage engine

Answer

Querying

Case Insensitive Querying

Answer

Asking Questions

It Doesn't Work

What doesn't work how? Add to the question:

  • What you have done
  • What the results were

See also this

Reference MongoDB Documentation

You are asking a question about how MongoDB behaves but you have not referenced official documentation describing the behavior you are asking about.

Please link to the official documentation from your question that describes the behavior that you are asking about.

Specify Software Versions

Your question may have different answers depending on which version of MongoDB, the driver, etc. you are using. Please include versions of all components you are asking about in your question.

Some of the components are:

  • Server
  • mongo shell
  • Driver

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published