Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1065

Collection#insert_many raise undefined method `each_with_index'

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: 2.1.2
    • Component/s: Public API
    • None
    • Environment:
      ruby 2.1.5

      Calling Mongo::Collection#insert_many with an array containing a document that exceed the size limit of mongodb document raises NoMethodError: undefined method `each_with_index'. I was expecting it to raise Mongo::Error::MaxBSONSize

      In the spec below the second example fails.

      require 'spec_helper'
      
      describe "Inserting Document exeeding max size" do
        let(:documents) do
          [{ '_id' => 1,
             'name' => '1'*17000000 }]
        end
      
        context 'insert_many' do
          it 'raise MaxBSONSize' do
            expect {
              authorized_collection.insert_many(documents)
            }.to raise_error(Mongo::Error::MaxBSONSize)
          end
        end
      end
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            ajoulie Antoine Joulie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: