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

Collection#insert_many raise undefined method `each_with_index'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.1.2
    • 12_01_17
    • Public API
    • None
    • ruby 2.1.5

    Description

      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
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: