Commit Graph

144 Commits

Author SHA1 Message Date
Kyle Banker 7a11bb18a9 Ensure that cursor requiring getmore ops will not
be affected by replica set refresh.

Prep for sending commands to secondaries.
2011-10-17 14:41:09 -04:00
Kyle Banker e678bac75e RUBY-306 clean up logging. 2011-09-07 17:14:53 -04:00
Kyle Banker 75941ad2a3 minor: Cursor cleanup 2011-09-07 10:17:24 -04:00
Kyle Banker 1c439df278 RUBY-312 Enable exhaust-mode queries. 2011-09-07 10:02:10 -04:00
Kyle Banker 7ac19f1bfa minor: Cursor#next over Cursor#next_document 2011-09-06 16:23:55 -04:00
Kyle Banker 50c38c6c6b RUBY-284 document :read API 2011-09-06 14:58:03 -04:00
Kyle Banker 046038e18d RUBY-297 when possible, include error codes and
return objects in exception classes.
2011-09-06 14:22:50 -04:00
Kyle Banker 834b0db0af RUBY-307 Collection#count should take a query, skip, and limit. 2011-09-06 11:38:19 -04:00
Kyle Banker 45c40e7267 RUBY-320 RUBY-284 initial cascading read API. Mapping sockets to pools. 2011-08-29 17:49:58 -04:00
Kyle Banker 82b103752e RUBY-289 ensure that negative limit is logged 2011-08-08 18:31:30 -04:00
Kyle Banker b32f895ed6 RUBY-288 ensure we cannot modify with add_option or remove_option after iteration starts. 2011-08-05 18:22:09 -04:00
Kyle Banker 1142c33910 RUBY-288 Cursor#remove_option 2011-08-05 18:15:48 -04:00
Kyle Banker 96b39313bf RUBY-267 Cursor#alive? 2011-08-05 17:54:38 -04:00
Kyle Banker eecb1d35de Revert "RUBY-167 Cursor#alive?"
This reverts commit 91308cdc60.
Wrong JIRA Issue
2011-08-05 17:52:44 -04:00
Kyle Banker 91308cdc60 RUBY-167 Cursor#alive? 2011-08-05 17:51:37 -04:00
Kyle Banker 237dc98fbf RUBY-283 add_option for cursors. Deprecate Cursor#query_opts. 2011-08-05 11:52:45 -04:00
Karl Seguin 7783cebfdf batch_size is taken into account when limit is 0/not set 2011-06-16 22:21:40 +08:00
Kyle Banker b8ab13e7f9 Revert "RUBY-267 Cursor#alive?"
This reverts commit 05dfef2f11.
This adds new functionality and thus must wait for the 1.4 release.
2011-05-10 15:58:23 -04:00
Kyle Banker 05dfef2f11 RUBY-267 Cursor#alive? 2011-05-10 15:45:32 -04:00
Kyle Banker 9a80fbaa66 RUBY-266 support maxscan, showDiskLoc, and returnKey 2011-05-10 15:40:06 -04:00
Kyle Banker 604d0f60ed RUBY-261 Cursor#close hits secondary when appropriate. 2011-05-10 14:21:23 -04:00
Kyle Banker 2bfe205c51 Merged wpiekutowski's commits to enable warnings
on test suite and clean up some code.

Conflicts:
	test/cursor_test.rb
2011-03-23 16:02:04 -04:00
John Nunemaker 53ad43fedc Added transformer concept.
Can be passed to find/find_one, which in turn is passed to cursor. It is an optional block that makes it easier to turn documents that are returned into hashes.

cursor = collection.find({...}, :transformer => Proc.new { |doc| User.load(doc) })
cursor.next # returns instance of User instead of ordered hash

This will allow MongoMapper, ToyStore and other object mappers to take better advantage of Cursors. No more calling to_a and mapping to instances.
2011-03-23 15:26:34 -04:00
Kyle Banker 8df0ff23f5 RUBY-249 Alias Cursor#next for Cursor#next_document 2011-03-15 14:24:34 -04:00
Wojciech Piekutowski 62900acb4b Initialize @cursor_id 2011-02-20 17:03:32 +01:00
Wojciech Piekutowski 5dfac28dd4 Fix Mongo::Cursor#query_options_hash 2011-02-20 16:22:39 +01:00
Kyle Banker d63cf18042 minor: note 2011-02-02 09:51:13 -05:00
Kyle Banker 9c83ca6b3e minor style and doc fixes. warning about logging performance issues. 2011-01-31 15:51:39 -05:00
Steve Sloan 8a7296599b Refactored logging of DB operations to use Connection#instrument.
This allows for easy overriding, e.g. to ActiveSupport notifications.
2011-01-31 15:13:12 -05:00
Kyle Banker 0d91faf6b1 RUBY-226 minor: license update 2011-01-17 12:26:32 -05:00
Kyle Banker a197ea7852 RUBY-219 minor: use opts instead of options throughout 2011-01-05 11:30:20 -05:00
Kyle Banker fa583762e7 RUBY-203 Use Hash#fetch when possible 2011-01-05 09:34:09 -05:00
Kyle Banker e621db732e minor: cleanup 2010-11-24 14:01:26 -05:00
Daniel Cooper df80704f77 Cursor#count now has optional argument to make it take notice of skip and limit 2010-11-24 13:51:05 -05:00
Kyle Banker 1e57ca90e1 Initial commit for reads from rs secondaries 2010-11-16 15:43:59 -05:00
Ijonas Kisselbach 2188522687 removed argument type checks from Cursor.skip() and Cursor.limit() due to clash with JRuby's redefining of Integer 2010-11-11 15:20:08 -05:00
Evgeny Shadchnev 8c96f5d52f removed batch_size accessor that's overridden by a method anyway 2010-11-11 15:08:24 -05:00
Evgeny Shadchnev af0822f476 initializing query_run and closed before they are first used 2010-11-11 15:08:01 -05:00
Kyle Banker c984af4ff0 Fixed bug passing :timeout to Cursor. Added tests. 2010-11-04 17:26:21 -04:00
Kyle Banker 3a0cdf64af remove deprecated support for implicit 2010-10-04 14:37:19 -04:00
Hongli Lai (Phusion) c8726ca150 Optimize MongoDB::Cursor#construct_query_message. 2010-09-13 10:51:15 -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
Kyle Banker 3a4134a5c2 RUBY-180 fixed failing test 2010-09-09 14:53:29 -04:00
Kyle Banker e03ea6b690 minor: typo fix 2010-09-09 14:22:09 -04:00
Kyle Banker 36c71ef48e RUBY-180 Fix batch size 2010-09-09 14:12:12 -04:00
Kyle Banker b339871eb9 minor: #refresh instead of #refill_via_get_more 2010-09-08 14:34:28 -04:00
Kyle Banker 300b442a94 Create logging message only when a logger is passed to the Connection.
Results in a pretty significant performance improvement.

Many thanks to Matt Taylor for noticing the unusual glut of calls
to ObjectId#to_s. See here: http://unhalting.com/?p=18
2010-09-08 14:27:27 -04:00
Kyle Banker 6b2939f2f7 RUBY-171 allow Cursor#to_a even after iterating; added Cursor#rewind; consistent Enumberable behavior for Cursor 2010-08-26 12:35:42 -04:00
Kyle Banker 7bb59610b7 minor: kill cursors only when necessary 2010-08-06 16:02:51 -04:00
Kyle Banker c9573f05ad minor: fix default timeout option 2010-07-16 14:04:13 -04:00