0.5.0: Command renameCollection failed: target namespace exists.
See original GitHub issueGreetings folks -
Just tried your new 0.5.0 release and getting the following error:
Failed to configure mongo connection: Command renameCollection failed: target namespace exists.
Here’s my code for reference:
try
{
HostingEnvironment.RegisterObject(this);
Log.InfoFormat("Configuring Mongo connection: {0}", Config.HangfireDatabaseConnectionString);
if (GlobalConfiguration.Configuration == null)
throw new Exception("Hangfire.GlobalConfiguration.Configuration is null!");
var migrationOptions = new MongoMigrationOptions
{
Strategy = MongoMigrationStrategy.None
};
var storageOptions = new MongoStorageOptions
{
MigrationOptions = migrationOptions
};
GlobalConfiguration.Configuration.UseMongoStorage(Config.HangfireDatabaseConnectionString, Config.HangfireDatabase, storageOptions);
}
catch (Exception e)
{
Log.ErrorFormat("Failed to configure mongo connection: {0}", e.Message);
throw;
}
The error persists even after manually deleting all prior collections (hangfire.*
only) in the hangfire db. Note that my hangfire db has 2 other collections (as seen below)

These are unrelated to Hangfire.Mongo and I need to preserve them - so I did not delete them.
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
0.5.0: Command renameCollection failed: target ...
0 release and getting the following error: Failed to configure mongo connection: Command renameCollection failed: target namespace exists.
Read more >How do I rename a mongo collection in Mongoid?
10027 – Raised if the target namespace exists and dropTarget is either ... renaming the collection to artist_lookups on your MongoDB server, ...
Read more >[#SERVER-60632] Inconsistent error on mongos when ...
When renaming a collection to a target that already exists (without specifying dropTarget) renameCollection will fail with the following: ...
Read more >renameCollection — MongoDB Manual
Starting in MongoDB 5.0, you can use the renameCollection command to change the name of a sharded collection. The target database must be...
Read more >tsuru Documentation
You manage your app using the tsuru command-line ... we will get another error: “Table 'blogsql.django_session' doesn't exist”.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
0.5.1 seems to have fixed this issue thanks
@rajivkukreja, seems like you reopened the wrong issue. I am reopening this instead: #70 and closing this one.