Commit Graph

660 Commits

Author SHA1 Message Date
Kyle Banker 68af3dbe8f Allow the setting of safe mode globally on the Connection,
DB, and Collection levels. The safe mode setting will
automatically be inherited down the hierarchy Connection ->
DB -> Collection -> (insert, update, remove). This default
can be overridden at any time. Connection#safe, DB#safe, and
Collection#safe will yield the current default value.
2010-11-03 17:36:08 -04:00
Kyle Banker f7d151c8dc minor: doc fixes 2010-11-03 15:32:19 -04:00
Kyle Banker d6f8f9d41a Allow specification of replica set name on connect.
Raise ReplicaSetConnectionError if expected name doesn't match set.
2010-11-03 15:12:15 -04:00
Kyle Banker 5aa8721b25 Allow idiomatic :drop_dups in addition to :dropDups
on index creation.

Don't raise exception if :dropDups results in duplicate key error.
2010-11-02 14:50:02 -04:00
Kyle Banker e21a4b897a minor: extra rake tasks for tests. don't show C ext warning when testing 2010-11-02 14:25:14 -04:00
Kyle Banker 2939932526 close connection when safe mode insert results in 'not master' 2010-10-29 23:18:49 -04:00
Kyle Banker 424f08af5e close connection on exception on safe insert 2010-10-29 17:52:15 -04:00
Kyle Banker 2720206f77 minor: docs 2010-10-22 13:27:56 -04:00
Kyle Banker e416e05fc7 RUBY-190 bug fix for unavailable nodes on Connection#multi 2010-10-21 14:33:48 -04:00
Kyle Banker a905c3f1f2 RUBY-191 fix to pass options to new db with Connection#db 2010-10-21 13:27:57 -04:00
Kyle Banker afe8fe3167 RUBY-193 don't create gridfs indexes when slave_ok 2010-10-21 13:01:32 -04:00
Kyle Banker 68cadc1987 minor: patch for JRuby 1.9 MD5 comparison bug 2010-10-14 16:35:13 -04:00
Kyle Banker f1ddd871f2 major: typo 2010-10-13 18:38:15 -04:00
Kyle Banker 80044b9a58 RUBY-187 All tests can now use custom host and port;
Minor test fixes.
2010-10-13 17:09:23 -04:00
Kyle Banker cd03fafb27 RUBY-187 ByteBuffer should take another ByteBuffer as initial data 2010-10-13 17:08:45 -04:00
Kyle Banker df0377c3d4 JRuby Test fixes 2010-10-12 15:39:28 -04:00
Kyle Banker b0f2911170 BUMP 1.1.1 2010-10-07 17:59:12 -04:00
Kyle Banker 0c82f01d97 JRuby: validate key names and only move _id when necessary. 2010-10-07 17:42:39 -04:00
Kyle Banker 850159cd7c BUMP 1.1 2010-10-04 15:19:14 -04:00
Kyle Banker 3a0cdf64af remove deprecated support for implicit 2010-10-04 14:37:19 -04:00
Kyle Banker b8d6f57602 A few more BSON fixes 2010-10-04 14:25:44 -04:00
Jari Bakken 112870b537 Get rid of missing parentheses warning. 2010-10-04 13:32:46 -04:00
Jari Bakken 9d2f3fbc27 Call super in BSON::OrderedHash#== instead of doing the comparison in Ruby.
This has a notable performance impact for large hashes.
2010-10-04 13:32:33 -04:00
Kyle Banker b3ed1486e5 minor: updates for removal deprecated DB and Connection methods and ObjectID 2010-10-04 13:28:26 -04:00
Kyle Banker bd4b6060f7 Removed deprecated DB methods 2010-10-04 12:16:40 -04:00
Kyle Banker f7a97a0db0 Removed deprecated Connection methods 2010-10-04 12:16:11 -04:00
Kyle Banker 8dce3a613d Removed deprecated ObjectID class (use ObjectId now) 2010-10-04 12:15:14 -04:00
Kyle Banker bf10db9b21 minor: ObjectId optimization 2010-10-04 12:09:29 -04:00
Kyle Banker 7ad280c2cb RUBY-184 Connection#locked? 2010-10-04 11:38:20 -04:00
Kyle Banker c04dfec1db Revert JRuby callback to use RubyBSONCallback 2010-10-01 13:57:16 -04:00
Kyle Banker 315e608cd4 Optimized callback class to return Java objects 2010-10-01 09:52:29 -04:00
Kyle Banker 2a7b089a9b BSON for JRuby 2010-09-30 09:43:17 -04:00
Kyle Banker 4141331f79 RUBY-184 fsync lock helpers 2010-09-28 12:15:45 -04:00
Kyle Banker a1565b3ac8 BUMP 1.0.9 2010-09-20 15:07:30 -04:00
Hongli Lai (Phusion) b474b29d35 Optimize Mongo::Connection#receive_message_on_socket and #receive_and_discard_message_on_socket: avoid creating initial input buffer up front so that IO#read only needs to allocate the buffer once. 2010-09-14 10:37:08 -04:00
Hongli Lai (Phusion) 6316c939d5 Optimize Mongo::Connection#send_message_on_socket: don't slice the input when not necessary. 2010-09-14 10:36:54 -04:00
Hongli Lai (Phusion) 87e6d578c1 Optimize Mongo::Connection#add_message_headers by packing data directly instead of using ByteBuffer. 2010-09-14 10:36:40 -04:00
Kyle Banker f494c9601d minor: comment cleanup 2010-09-13 14:44:41 -04:00
Hongli Lai (Phusion) 0585aa1aae Fix MongoDB::Collection #insert_documents, #update and #remove and MongoDB::Connection #receive_header and #last_error_message: usage strings as much as possible instead of byte arrays, otherwise performance really suffers. 2010-09-13 10:51:53 -04:00
Hongli Lai (Phusion) 264bddbeee Fix reference to NULL_BYTE. 2010-09-13 10:51:44 -04:00
Hongli Lai (Phusion) c8726ca150 Optimize MongoDB::Cursor#construct_query_message. 2010-09-13 10:51:15 -04:00
Hongli Lai (Phusion) bde53f1e20 Optimize ByteBuffer: use binary string as underlying storage instead of array. 2010-09-13 10:51:02 -04:00
Hongli Lai (Phusion) c6206eddf4 Optimize MongoDB::Connection#receive_response_header by using raw string operations and unpack() instead of the slower ByteBuffer. 2010-09-13 10:50:39 -04:00
Hongli Lai (Phusion) e1bf168767 Optimize MongoDB::Connection#receive.
It doesn't do anything with the header. So instead of parsing the header,
just read the header data and discard it.
2010-09-13 10:50:25 -04:00
Hongli Lai (Phusion) 2291a59fcc Optimize Mongo::Connection#read_documents by using raw string operations and unpack() instead of the slower ByteBuffer. 2010-09-13 10:50:16 -04:00
Hongli Lai (Phusion) 1c25541492 Optimize ByteBuffer#get_int. 2010-09-13 10:50:04 -04:00
Hongli Lai (Phusion) 026e409d6d Optimize Ruby 1.8 implementation of BSON::OrderedHash.
The set in there is unnecessary. Use the hash itself as "set". This makes
BSON::OrderedHash 148% faster on Ruby 1.8.
2010-09-13 10:49:50 -04:00
Hongli Lai (Phusion) 117ce2389c Optimize receive_message_on_socket for the optimistic average case where 1 socket.read() operation receives all requested data. Also fix some Ruby 1.9 encoding issues in that function while we're at it. 2010-09-13 10:48:32 -04:00
Mislav Marohnić 56f37e49b6 replace usage of `returning` with `each_with_object`
`each_with_object` is a Ruby 1.9 method, here re-implemented in core_ext.rb
in case it's missing (for older Ruby versions). Using `returning` is bad in
combination with Ruby on Rails because each usage of the method will emit
a Rails deprecation warning. This might be considered an Active Support bug,
but it's better to avoid using `returning` altogether and use `tap` from
Ruby 1.8.7, also re-implemented here in case it's missing.

Since existing usages or `returning` were better suited for `each_with_object`
than `tap`, they were rewritten using the former instead.
2010-09-13 01:10:38 +08:00
Hongli Lai (Phusion) b9de2eaa5c When possible, have BSON::ByteBuffer store the underlying binary data as a binary String instead of an array.
This dramatically improves the performance of BSON::ByteBuffer.new(a_string).
On Ruby 1.9.2 it is about 130 times faster.
2010-09-09 15:59:17 -04:00