Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3566

unable to to manually set mongodb flag usePowerOf2Sizes

    • Type: Icon: Task Task
    • Resolution: Done
    • 4.0.0 final
    • Affects Version/s: None
    • Component/s: None
    • None

      I am trying to manually set usePowerOf2Sizes a new mongodb feature

      The MongoDB doc's said the flag should be set with:

      db.runCommand(

      {collMod: "collection-name", usePowerOf2Sizes : true }

      )

      So in rails console after getting a Mongoid session, I ran the command below, where note_books is my collection name.

      session.command(collMod: "note_books", userPowerOf2Sizes: true)

      The command above throws the error

      MOPED: 54.205.251.202:10056 COMMAND database=appt command={:collMod=>"note_books", :userPowerOf2Sizes=>true} runtime: 117.0294ms
      Moped::Errors::OperationFailure: The operation: #<Moped::Protocol::Command
      @length=87
      @request_id=5
      @response_to=0
      @op_code=2004
      @flags=[]
      @full_collection_name="appt.$cmd"
      @skip=0
      @limit=-1
      @selector={:collMod=>"note_books", :userPowerOf2Sizes=>true}
      @fields=nil>
      failed with error "unknown option to collMod: userPowerOf2Sizes"

      If I change the command to use collmod instead of collMod

      session.command(collmod: "note_books", userPowerOf2Sizes: true)

      The error becomes failed with error "no such cmd: collmod"

            Assignee:
            Unassigned Unassigned
            Reporter:
            mankind mankind
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: