-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.7.0
-
Component/s: Reactive Streams
-
Not Needed
Summary
Hello everyone,
When attempting to create a new collection when it already exists, an IllegalStateException is thrown, in addition to the usual MongoCommandException.
This is a bug since the sync driver only throws the MongoCommandException, and this problem appears with the reactive streams driver since version 4.7.0 only.
How to Reproduce
MongoClient mongoClient = MongoClients.create(); MongoDatabase exampleDatabase = mongoClient.getDatabase("foo"); SubscriberHelpers.ObservableSubscriber<Void> voidSubscriber = new SubscriberHelpers.OperationSubscriber<>(); exampleDatabase.createCollection("bar").subscribe(voidSubscriber); voidSubscriber.await();
If the collection already exists, you should see this stack trace: https://gist.github.com/Romitou/f552416d07f9608e2ddbecfa5c03e309
Additional Background
As said before, this bug only appears from version 4.7.0 and only on the reactive streams driver, I think this is relevant information.