Skip to content

Commit

Permalink
Initial commit for reads from rs secondaries
Browse files Browse the repository at this point in the history
  • Loading branch information
banker committed Nov 16, 2010
1 parent 43182b8 commit 1e57ca9
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 172 deletions.
1 change: 1 addition & 0 deletions lib/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module Constants
require 'mongo/util/conversions'
require 'mongo/util/support'
require 'mongo/util/core_ext'
require 'mongo/util/pool'
require 'mongo/util/server_version'

require 'mongo/collection'
Expand Down
4 changes: 2 additions & 2 deletions lib/mongo/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def find_one(spec_or_object_id=nil, opts={})
def save(doc, opts={})
if doc.has_key?(:_id) || doc.has_key?('_id')
id = doc[:_id] || doc['_id']
update({:_id => id}, doc, :upsert => true, :safe => opts[:safe])
update({:_id => id}, doc, :upsert => true, :safe => opts.fetch(:safe, @safe))
id
else
insert(doc, :safe => opts[:safe])
insert(doc, :safe => opts.fetch(:safe, @safe))
end
end

Expand Down
Loading

0 comments on commit 1e57ca9

Please sign in to comment.