moped 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of moped might be problematic. Click here for more details.

@@ -1,5 +1,26 @@
1
1
  # Overview
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Resolved Issues
6
+
7
+ * \#156 Collection#drop will raise on any error other than collection
8
+ does not exist.
9
+ (Daniel Doubrovkine)
10
+
11
+ * \#152 Added `errmsg` "not master" to replica set configuration check.
12
+ (Christos Trochalakis)
13
+
14
+ * \#151 Dropping collections now always uses primary. (Christos Trochalakis)
15
+
16
+ * \#150 Handle cases where Mongo does not bring back a `query_failure` flag
17
+ in the reply, but has an error document present.
18
+
19
+ * mongoid/mongoid#2849 Supply proper limit to initial query if either
20
+ limit or batch_size are provided.
21
+
22
+ * mongoid/mongoid#2831 Fix node refresh when no peers exist.
23
+
3
24
  ## 1.4.1/1.4.2
4
25
 
5
26
  ### Resolved Issues
@@ -284,7 +284,7 @@ module Moped
284
284
 
285
285
  def refresh_peers(node, &block)
286
286
  peers = node.peers
287
- return if peers.empty?
287
+ return if !peers || peers.empty?
288
288
  peers.each do |node|
289
289
  block.call(node) unless @nodes.include?(node)
290
290
  @peers.push(node) unless peers.include?(node)
@@ -35,8 +35,11 @@ module Moped
35
35
  # @since 1.0.0
36
36
  def drop
37
37
  begin
38
- database.command(drop: name)
39
- rescue Moped::Errors::OperationFailure
38
+ database.session.with(consistency: :strong) do |session|
39
+ session.context.command(database.name, drop: name)
40
+ end
41
+ rescue Moped::Errors::OperationFailure => e
42
+ raise e unless e.details["errmsg"] == "ns not found"
40
43
  false
41
44
  end
42
45
  end
@@ -132,7 +132,7 @@ module Moped
132
132
  @options[:flags] |= [:no_cursor_timeout] if @options[:no_timeout]
133
133
 
134
134
  options = @options.clone
135
- options[:limit] = @options[:batch_size] if @options[:batch_size]
135
+ options[:limit] = request_limit
136
136
 
137
137
  reply, @node = session.context.with_node do |node|
138
138
  [ node.query(@database, @collection, @selector, options), node ]
@@ -103,7 +103,9 @@ module Moped
103
103
  # error with code 13435, or with an error message stating the server is
104
104
  # not a master. (This encapsulates codes 10054, 10056, 10058)
105
105
  def reconfiguring_replica_set?
106
- details["code"] == 13435 || details["err"] == "not master"
106
+ details["code"] == 13435 ||
107
+ details["err"] == "not master" ||
108
+ details["errmsg"] == "not master"
107
109
  end
108
110
  end
109
111
 
@@ -501,6 +501,23 @@ module Moped
501
501
  auth.delete(database)
502
502
  end
503
503
 
504
+ private
505
+
506
+ def generate_peers(info)
507
+ peers = []
508
+ peers.push(info["primary"]) if info["primary"]
509
+ peers.concat(info["hosts"]) if info["hosts"]
510
+ peers.concat(info["passives"]) if info["passives"]
511
+ peers.concat(info["arbiters"]) if info["arbiters"]
512
+ @peers = peers.map{ |peer| discover(peer) }.uniq
513
+ end
514
+
515
+ def discover(peer)
516
+ Node.new(peer, options).tap do |node|
517
+ node.send(:auth).merge!(auth)
518
+ end
519
+ end
520
+
504
521
  def initialize_copy(_)
505
522
  @connection = nil
506
523
  end
@@ -67,7 +67,7 @@ module Moped
67
67
  # @since 1.2.10
68
68
  def command_failure?
69
69
  result = documents[0]
70
- result["ok"] != 1 || result["err"] || result["errmsg"]
70
+ result["ok"] != 1 || result["err"] || result["errmsg"] || result["$err"]
71
71
  end
72
72
 
73
73
  # Was the provided cursor id not found on the server?
@@ -91,7 +91,8 @@ module Moped
91
91
  #
92
92
  # @since 1.2.0
93
93
  def query_failed?
94
- flags.include?(:query_failure)
94
+ result = documents[0]
95
+ flags.include?(:query_failure) || (result && result["$err"])
95
96
  end
96
97
 
97
98
  # Is the reply an error message that we are not authorized for the query
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.4.2"
3
+ VERSION = "1.4.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-09 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A MongoDB driver for Ruby.
15
15
  email:
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: -1167017999855921065
92
+ hash: 2209101216124577451
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: -1167017999855921065
101
+ hash: 2209101216124577451
102
102
  requirements: []
103
103
  rubyforge_project:
104
104
  rubygems_version: 1.8.24