Database Operations in MongoDB 3.6

Last updated: 2019-08-12 12:00:50

PDF

Problem Description

If you repeatedly drop a database and then create a new database with the same name in for a MongoDB 3.6 instance, an error "database does not exist" may occur when you try to read, write to or drop this database, as shown below:

Solution

It is a common problem, which may be caused by mongos not refreshing its metadata cache. For more information, see official explanation, as shown below:

Select one of the following two solutions for troubleshooting:

  1. Restart mongos on the console.
  2. Run the flushRouterConfig command. Click the link to see detailed description.