Commit Graph

155 Commits

Author SHA1 Message Date
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
Kyle Banker
b1cf0d1e13 minor: close connection before exception 2010-07-15 14:13:40 -04:00
Kyle Banker
86c50a0555 Removed deprecated options and methods. 2010-07-12 14:31:12 -04:00
Kyle Banker
265f074f10 RUBY-147 check for CursorNotFound response flag 2010-07-12 12:11:01 -04:00
Kyle Banker
030c850669 minor: nicer query opts generation 2010-07-09 16:15:36 -04:00
Kyle Banker
2121d6c809 minor: cleaner output for cursor inspect 2010-07-02 17:24:45 -04:00
Kyle Banker
a7e2991c31 fix for boolean command response in core server 1.5.2 2010-05-31 22:52:03 -04:00
Kyle Banker
924a275ea3 check command response by default; better DB#command api 2010-05-18 16:17:17 -04:00
Mike Dirolf
edd8a7104f default batch size should always be 0 2010-05-10 12:11:23 -04:00
Kyle Banker
97ee66be02 minor: source file encoding with magic comment 2010-05-07 15:33:27 -04:00
Kyle Banker
3209ca05fd deprecate JavaScript string for Collection#find 2010-05-07 15:16:38 -04:00
Kyle Banker
06c7934675 RUBY-127 2010-05-07 15:15:52 -04:00
sleverbor
ed76126a12 namespaced the OrderedHash class 2010-05-06 18:25:18 -07:00
Kyle Banker
acc42dce65 RUBY-115 tailable cursors 2010-04-12 13:53:18 -04:00
Kyle Banker
b9f579876c RUBY-120 configurable batch size; begin 0.20.2 2010-04-12 11:57:14 -04:00
Kyle Banker
35dac1f31e added find_and_modify helper 2010-04-06 17:56:21 -04:00
Kyle Banker
c4d5cb641b renamed mongo_bson to bson 2010-04-05 10:39:55 -04:00
Kyle Banker
c276a23615 minor: use $ with query and orderby params on query message 2010-03-30 12:26:57 -04:00
Houdini
33f4aca658 More flexible :fields option, supporting {}
This allows exact definition of the fields you want included in the query results. For example :fields => {:name => 1, :people => 0} will include the name key but exclude the people key.
2010-03-26 13:58:18 -07:00
Kyle Banker
a94a870202 log messages read like valid ruby driver code 2010-03-23 22:40:43 -07:00
Kyle Banker
f2bc05f51c merge new bson commits 2010-03-19 15:23:24 -04:00
Kyle Banker
4008752b02 RUBY-113 allow has_next for cursors 2010-03-19 14:31:31 -04:00
Charles Remes
a9b3c8e7a5 Try again: Split the BSON logic out to a separate gem
- changed the BSON constant to BSON_CODER and scoped it inside
      of a module

    - changed the directory layout for all of the BSON related files

    - updated the C extension to find the BSON files at their new
      directory locations

    - updated the C extension to use better/safer macros for accessing
      the C API; extension now compiles cleanly under rubinius/rbx

    - changed directory layout for BSON related tests

    - modified the Rakefile to understand the new layout
2010-03-17 14:55:19 -05:00
Kyle Banker
8faa243484 added sort to query logging RUBY-101 2010-03-15 11:51:22 -04:00
Kyle Banker
d6111f535c removed deprecated Cursor#next_object 2010-02-23 13:09:36 -05:00
Kyle Banker
5dd2636634 minor: copyright update 2010-02-19 17:41:36 -05:00
Kyle Banker
98af49f465 added core doc references 2010-02-08 12:12:18 -05:00
Kyle Banker
ba2b23476d minor performance improvements 2010-01-14 13:30:38 -05:00
Kyle Banker
523f0ebc2c yard for Cursor 2010-01-08 16:18:07 -05:00
Kyle Banker
7655a2c424 deprecated Cursor#next_object for Cursor#next_document 2009-12-16 18:09:48 -05:00
Kyle Banker
f8a6d1ebb9 minor: docs, whitespace, naming 2009-12-16 14:16:49 -05:00
Kyle Banker
992f6c30dc minor: removed entraneous constant 2009-12-02 11:56:58 -05:00
Kyle Banker
d40f445c19 Fixes for 1.9 2009-12-01 17:23:24 -05:00
Kyle Banker
05b5fc576b Cleanup w/r/t loading c ext and testing it 2009-12-01 13:49:57 -05:00
Kyle Banker
ab0d189832 Simplified message sending methods names; organized Connection 2009-11-24 14:23:43 -05:00
Kyle Banker
515594ebf3 Completed deprecation of old sort options, :offset, and Collection#clear 2009-11-23 18:09:13 -05:00
Kyle Banker
11a92349e9 Merged branch for initial connection pooling code 2009-11-23 15:20:05 -05:00
Kyle Banker
7890d6e146 Fixes for replica pairs. 2009-11-23 13:13:14 -05:00
Kyle Banker
3362fb5be6 Simplified BSON serialization calls for performance. 2009-11-12 14:48:49 -05:00
Kyle Banker
41c95a0392 refactoring: moved receive methods from cursor to db class. 2009-11-04 17:46:15 -05:00
Kyle Banker
68bb1d2060 minor: Initial collection unit tests. Logging message update. 2009-11-02 15:50:16 -05:00
Kyle Banker
95f3686119 Restored pretty messages for logging. 2009-11-02 15:04:06 -05:00
Kyle Banker
67b7f6b375 Refactored Query class into Cursor class. 2009-10-22 14:10:12 -04:00
Kyle Banker
de5c078cec Finished removing Message classes. Made Cursor#close threadsafe. 2009-10-21 10:11:33 -04:00
Kyle Banker
b938765ac0 Removed GetMoreMessage and QueryMessage classes with initial refactoring. 2009-10-20 15:44:46 -04:00
Mike Dirolf
4fdcad1327 cleanup and credits 2009-10-08 10:05:06 -04:00
Mike Dirolf
de6fef357b driver was sending hard limits where it should've sent soft, and vice-versa. fix and add tests for this 2009-09-30 10:49:08 -04:00
Mike Dirolf
70c23e2d32 deprecate :offset option to find in favor of :skip 2009-09-17 16:45:03 -04:00
Mike Dirolf
f41b48a51b minor: tweaks and some more test cases 2009-09-17 15:07:37 -04:00
Mike Dirolf
1b98a1961f minor: credits, doc 2009-09-17 15:07:36 -04:00
mbernstein
e6710621a7 copied docs from sort 2009-09-17 15:07:36 -04:00
mbernstein
d1e45fdb1a casting input from sort method as ordered hash, tweaking tests a bit 2009-09-17 15:07:36 -04:00
mbernstein
bdafae6eeb Added sort() method to Cursor Class, with tests and docs. 2009-09-17 15:07:36 -04:00
Mike Dirolf
3321a90739 remove redundant num_to_return from Cursor class. credits. clean up last commit 2009-09-16 17:52:41 -04:00
Kyle Banker
c397758d1d Added #limit and #offset methods for cursor objects
Signed-off-by: Mike Dirolf <mike@dirolf.com>
2009-09-17 05:38:00 +08:00
Mike Dirolf
b6901673bb always use hard limit for explain() 2009-09-16 10:39:52 -04:00
Mike Dirolf
86d2bf7186 minor: remove superfluous call 2009-09-14 14:28:01 -04:00
Mike Dirolf
496af2be9c fix for count when find has fields specified 2009-08-24 17:21:49 -04:00
Mike Dirolf
fd3b927771 API CHANGE no longer save internal array for to_a - means you can't call each or to_a after calling to_a already, doc updates 2009-08-21 14:11:59 -04:00
Mike Dirolf
6a43aaa94f minor: doc 2009-08-21 11:21:33 -04:00
Mike Dirolf
28e795e9e2 minor: make methods private instead of protected or documented as private but actually public 2009-08-21 11:03:56 -04:00
Mike Dirolf
e65dd99667 API CHANGE: moving XGen::Mongo::Driver and XGen::Mongo to Mongo and XGen::Mongo::GridFS to GridFS 2009-08-20 10:50:48 -04:00
Mike Dirolf
dcda70fddd don't send a getmore immediately after every query 2009-08-18 17:36:53 -04:00
Mike Dirolf
103224b800 add Cursor#count method 2009-08-18 11:26:58 -04:00
Mike Dirolf
1e4728a77f fix a deadlock with threaded queries 2009-08-10 16:10:52 -04:00
Mike Dirolf
91d6ab4caa rename collection 2009-08-04 14:16:02 -04:00
Mike Dirolf
db7cb56fc7 remove debugging cruft 2009-03-16 09:38:07 -04:00
Mike Dirolf
56fddf79d4 dbrefs only need an oid and a collection, not all this extra cruft... 2009-03-10 14:17:01 -04:00
Mike Dirolf
8b9bcb1e63 add back in logging and size checks around all socket receive's 2009-03-06 10:02:43 -05:00
Mike Dirolf
79b3df3c9e do all recv's in a loop. remove debugging cruft 2009-03-04 14:28:00 -05:00
Mike Dirolf
8b18502cd0 debug logs and assertions 2009-03-04 13:52:09 -05:00
Mike Dirolf
bdec973ff4 more debugging 2009-03-04 09:35:27 -05:00
Mike Dirolf
f907edcde5 more stuff to see on failure 2009-03-03 09:59:36 -05:00
Mike Dirolf
0d64ec9de1 temporarily raise a different exception 2009-03-03 09:27:38 -05:00
Geir Magnusson Jr
232a7f7169 Clarify license to be the Apache License v2.0. Was a
mix and the readme still reflected AGPL
2009-02-15 08:24:14 -05:00
Jim Menard
9a7ed4c3d3 comment 2009-02-09 13:13:13 -05:00
Jim Menard
8ecc8cb305 Remove debug warnings. 2009-02-05 15:59:44 -05:00
Jim Menard
04b0b926d4 comments 2009-02-03 12:43:09 -05:00
Jim Menard
b3bc2c41e2 Moved hint call from Cursor into Collection#find options and Query#initialize
parameter.
2009-01-29 07:15:59 -05:00
Jim Menard
d01a4f5fdb Added auto_reconnect and slave_ok options and behavior to DB connections. 2009-01-23 11:47:22 -05:00
Jim Menard
b8e3a98755 check for nil 2009-01-15 09:35:44 -05:00
Jim Menard
fce980fc47 Fixed $hint and $explain support. 2009-01-14 10:42:56 -05:00
Jim Menard
b82dd30579 Accept more types for hints args. 2009-01-14 10:28:32 -05:00
Jim Menard
50070c2efa Support for hints. 2009-01-13 15:51:41 -05:00
Jim Menard
61a0244c4c Pass Collection object, not name, to query so that we can access its hint fields at query time. 2009-01-13 15:38:46 -05:00
Jim Menard
1afd968f5d Added Cursor#explain. Made query sends lazy. 2009-01-13 14:02:16 -05:00
Jim Menard
97fa97bd2c Pass parent, name, and database to DBRef constructor when deserializing BSON 2009-01-09 15:22:10 -05:00
Jim Menard
fd6b0a2848 Raise an error if Cursor#to_a is called after Cursor#each but not also before. 2009-01-07 14:22:53 -05:00
Jim Menard
169a96ad5b Added Cursor#to_a and more tests and docs. 2009-01-07 14:07:17 -05:00
Jim Menard
26b88efd3b Bug fixes:
- Make sure Query#fields returns a hash, not an array.
- Fix query limit by passing limit number to cursor and having it enforce the
  limit. (Database returns limit as first batch, but will continue to return
  data after the limit if requested.)
Improvements:
- Query#new can take a single field name instead of an array
- A few doc comment improvements here and there.
2009-01-07 09:46:30 -05:00