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

MongoRecord not updating existing documents

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      MongoDB 0.9.1, mongo-activerecord-ruby git version 0abf50167616ad627460e633539d321c520409ac
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When using the MongoRecord framework changes to existing documents (with the save method) insert a new document into MongoDB rather than updating the existing document as would be expected.

      Some code that demonstrates this issue is as follows:

      class Test < MongoRecord::Base
      fields :name, :data
      collection_name 'test'
      end

      Test.delete_all({})

      t1 = Test.new({:name => 'test', :data => 'first'})
      t1.save
      t1.data = 'second'
      t1.save

      t2 = Test.find(:first, :conditions => {:name => 'test'})
      t2.data = 'third'
      t2.save

      results = Test.find(:all)
      results.each do |row|
      p row
      end

            Assignee:
            mike Michael Dirolf (Inactive)
            Reporter:
            sh Stephen Haynes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: