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

Update should use shard key

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:

      Description

      Let's have a collection sharded by key

      {answerer : 1}

      Then let's find an answer by its primary key:
      answer = Answer.find('4c91524c9b3b494747000019')

      Try to update
      answer.is_open = 1
      answer.save

      Save sends this
      Answer.collection.update({:_id => answer.id},
      {"$set" => {:opn => 1,
      :updated_at => Time.now}})

      This operation silently fails on Mongo side and Mongoid doesn't capture this.

      Should either fail as well, or send shard key along
      Answer.collection.update({:_id => answer.id, :answerer => @viewer.id},
      {"$set" => {:is_open => 1,
      :updated_at => Time.now}})

      We could be able to specify shard key in the model.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: