mongo 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -0
- data/docs/HISTORY.md +10 -3
- data/lib/mongo.rb +1 -1
- data/lib/mongo/collection.rb +10 -5
- data/lib/mongo/util/pool.rb +1 -2
- data/test/collection_test.rb +5 -1
- data/test/connection_test.rb +10 -0
- metadata +7 -7
data/Rakefile
CHANGED
@@ -175,6 +175,14 @@ namespace :gem do
|
|
175
175
|
sh "rm bson_ext-*.gem"
|
176
176
|
end
|
177
177
|
|
178
|
+
desc "Build all gems"
|
179
|
+
task :build_all do
|
180
|
+
sh "gem build mongo.gemspec"
|
181
|
+
sh "gem build bson.gemspec"
|
182
|
+
sh "gem build bson.java.gemspec"
|
183
|
+
sh "gem build bson_ext.gemspec"
|
184
|
+
end
|
185
|
+
|
178
186
|
end
|
179
187
|
|
180
188
|
namespace :ci do
|
data/docs/HISTORY.md
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
# MongoDB Ruby Driver History
|
2
2
|
|
3
|
+
### 1.2.4
|
4
|
+
2011-2-23
|
5
|
+
|
6
|
+
* Fix the exception message shown when there's an IOError (malditogeek)
|
7
|
+
* Another update to map-reduce docs for v1.8. Note that if you use the new
|
8
|
+
output option {:out => {:inline => true}}, then you must also specify
|
9
|
+
:raw => true.
|
10
|
+
|
3
11
|
### 1.2.3
|
4
12
|
2011-2-22
|
5
13
|
|
6
|
-
*
|
7
|
-
|
8
|
-
* Minor Collection#group doc update.
|
14
|
+
* Update docs for map-reduce command
|
15
|
+
* Minor doc fix
|
9
16
|
|
10
17
|
### 1.2.2
|
11
18
|
2011-2-15
|
data/lib/mongo.rb
CHANGED
data/lib/mongo/collection.rb
CHANGED
@@ -509,7 +509,7 @@ module Mongo
|
|
509
509
|
@db.command(cmd)['value']
|
510
510
|
end
|
511
511
|
|
512
|
-
# Perform a map
|
512
|
+
# Perform a map-reduce operation on the current collection.
|
513
513
|
#
|
514
514
|
# @param [String, BSON::Code] map a map function, written in JavaScript.
|
515
515
|
# @param [String, BSON::Code] reduce a reduce function, written in JavaScript.
|
@@ -529,11 +529,13 @@ module Mongo
|
|
529
529
|
# @option opts [Boolean ] :verbose (false) if true, provides statistics on job execution time.
|
530
530
|
# @option opts [Boolean] :raw (false) if true, return the raw result object from the map_reduce command, and not
|
531
531
|
# the instantiated collection that's returned by default. Note if a collection name isn't returned in the
|
532
|
-
# map-reduce output (as, for example, when using :out => {:inline => 1}), then this option
|
533
|
-
#
|
532
|
+
# map-reduce output (as, for example, when using :out => {:inline => 1}), then you must specify this option
|
533
|
+
# or an ArgumentError will be raised.
|
534
534
|
#
|
535
535
|
# @return [Collection, Hash] a Mongo::Collection object or a Hash with the map-reduce command's results.
|
536
536
|
#
|
537
|
+
# @raise ArgumentError if you specify {:out => {:inline => true}} but don't specify :raw => true.
|
538
|
+
#
|
537
539
|
# @see http://www.mongodb.org/display/DOCS/MapReduce Offical MongoDB map/reduce documentation.
|
538
540
|
#
|
539
541
|
# @core mapreduce map_reduce-instance_method
|
@@ -553,10 +555,13 @@ module Mongo
|
|
553
555
|
raise Mongo::OperationFailure, "map-reduce failed: #{result['errmsg']}"
|
554
556
|
end
|
555
557
|
|
556
|
-
if raw
|
558
|
+
if raw
|
557
559
|
result
|
558
|
-
|
560
|
+
elsif result["result"]
|
559
561
|
@db[result["result"]]
|
562
|
+
else
|
563
|
+
raise ArgumentError, "Could not instantiate collection from result. If you specified " +
|
564
|
+
"{:out => {:inline => true}}, then you must also specify :raw => true to get the results."
|
560
565
|
end
|
561
566
|
end
|
562
567
|
alias :mapreduce :map_reduce
|
data/lib/mongo/util/pool.rb
CHANGED
@@ -49,8 +49,7 @@ module Mongo
|
|
49
49
|
begin
|
50
50
|
sock.close
|
51
51
|
rescue IOError => ex
|
52
|
-
warn "IOError when attempting to close socket connected "
|
53
|
-
+ "to #{@host}:#{@port}: #{ex.inspect}"
|
52
|
+
warn "IOError when attempting to close socket connected to #{@host}:#{@port}: #{ex.inspect}"
|
54
53
|
end
|
55
54
|
end
|
56
55
|
@host = @port = nil
|
data/test/collection_test.rb
CHANGED
@@ -485,7 +485,11 @@ class TestCollection < Test::Unit::TestCase
|
|
485
485
|
res = @@test.map_reduce(m, r, :out => {:reduce => output_collection})
|
486
486
|
assert res.find.to_a.any? {|doc| doc["_id"] == 3 && doc["value"]["count"] == 2}
|
487
487
|
|
488
|
-
|
488
|
+
assert_raise ArgumentError do
|
489
|
+
@@test.map_reduce(m, r, :out => {:inline => 1})
|
490
|
+
end
|
491
|
+
|
492
|
+
@@test.map_reduce(m, r, :raw => true, :out => {:inline => 1})
|
489
493
|
assert res["results"]
|
490
494
|
end
|
491
495
|
end
|
data/test/connection_test.rb
CHANGED
@@ -264,5 +264,15 @@ class TestConnection < Test::Unit::TestCase
|
|
264
264
|
end
|
265
265
|
assert_equal 0, @con.primary_pool.checked_out.size
|
266
266
|
end
|
267
|
+
|
268
|
+
should "show a proper exception message if an IOError is raised while closing a socket" do
|
269
|
+
fake_socket = Mocha::Mock.new
|
270
|
+
fake_socket.stubs(:close).raises(IOError.new)
|
271
|
+
fake_socket.stub_everything
|
272
|
+
TCPSocket.expects(:new).returns(fake_socket)
|
273
|
+
|
274
|
+
@con.primary_pool.checkout_new_socket
|
275
|
+
assert_equal [], @con.primary_pool.close
|
276
|
+
end
|
267
277
|
end
|
268
278
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 4
|
10
|
+
version: 1.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Menard
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-02-
|
20
|
+
date: 2011-02-23 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -28,12 +28,12 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
hash:
|
31
|
+
hash: 23
|
32
32
|
segments:
|
33
33
|
- 1
|
34
34
|
- 2
|
35
|
-
-
|
36
|
-
version: 1.2.
|
35
|
+
- 4
|
36
|
+
version: 1.2.4
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id001
|
39
39
|
description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
|