Collection create method does not support some options

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.19.0
    • Affects Version/s: 2.18.1, 2.17.3
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Collection create method accepts a hash of options, that can contain among others the following keys: :capped, :max, :size, :collation: pipeline. However, these options are ignored and not used when creating a collection.

      The following code works properly, passing an invalid option value causes an error:

      %i(capped max size collation pipeline).each do |opt|
        client['coll'].drop
        begin
          client['coll', opt => 'x'].create
          puts "Option :#{opt} was ignored"
        rescue Mongo::Error::OperationFailure => e
          puts "Option :#{opt} was passed"
        end
      end
      

      The following code is broken, invalid options are ignored:

      %i(capped max size collation pipeline).each do |opt|
        client['coll'].drop
        begin
          client['coll'].create(opt => 'x')
          puts "Option :#{opt} was ignored"
        rescue Mongo::Error::OperationFailure => e
          puts "Option :#{opt} was passed"
        end
      end
      

              Assignee:
              Neil Shweky (Inactive)
              Reporter:
              Dmitry Rybakov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: