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

Collection#insert_many raise undefined method `each_with_index'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 12_01_17
    • Component/s: Public API
    • Labels:
      None
    • Environment:
      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

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

              Dates

              Created:
              Updated:
              Resolved: