Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4711

IllegalStateException when trying to create an existing collection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.7.0
    • 4.7.2
    • Reactive Streams
    • Not Needed

    Description

      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.

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            contact@romitou.fr Romain N/A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: