-
Moped 2 now only supports MongoDB 2.4.0 and higher.
-
Query.cursor will return a Enumerable instead of a Enumerator. (Arthur Neves)
-
Moped's BSON implementation has been removed in favor of the 10gen bson gem 2.0 and higher. All
Moped::BSON
references should be changed to justBSON
. -
#190 Connection retries are now logged. (Jan Paul Posma)
-
#133 Moped now supports the new read preferences that the core drivers provide. These include:
:primary
: Will always read from a primary node. (default):primary_preferred
: Attempt a primary first, then secondary if none available.:secondary
: Will always read from a secondary node.:secondary_preferred
: Attempt a secondary first, then primary if none available.:nearest
: Attempt to read from the node with the lowest latency.
Sample syntax:
Moped::Session.new([ "127.0.0.1:27017" ], read: :secondary) session.with(read: :nearest)[:users].find
The
:consistency
option is no longer valid and will be ignored. -
#92 Moped now defaults all writes to propagate (formerly "safe mode") and now has different propagate semantics:
{ w: -1 }
: Don't verify writes and raise no network errors.{ w: 0 }
: Don't verify writes and raise network errors.{ w: 1 }
: Verify writes on the primary node. (default){ w: n }
: Verify writes on n number of nodes.{ w: :majority }
: Verify writes on a majority of nodes.
Sample syntax:
Moped::Session.new([ "127.0.0.1:27017" ], write: { w: 0 }) session.with(write: { w: -1 })[:users].insert(document)
The
:safe
option is no longer valid and will be ignored.
- #196 Adding method on collection to rename itself (Arthur Neves)
- #210 Moped no longer attempts to refresh arbiters as they cannot be queried.
- #208 Fixed local jump errors in node. (Brian Norton)
-
The session now has an additional configuration option, called
auto_discover
. which defaults totrue
. Auto-discovery means that nodes that are not provided explicitly to the session but are visible will become available for read/write in the application. This behavior is the same as the existing behavior.The change here is to be able to turn this off by setting
auto_discover: false
. This will tell Moped to only send messages to nodes explicitly provided when instantiating the session.Example:
Moped::Session.new([ "127.0.0.1:27017" ], auto_discover: false)
- #191 Checking for "not authorized" in error messages. (Jonathan Hyman)
-
#174 Check for "unauthorized" in error messages since codes are not always there. (Jon Hyman)
-
#173 Ensure node
refreshed_at
is set even if the node is down, so down nodes don't get hit on every query.
-
Fixed BSON binary issues on Ruby 2.0.0.
-
#169 Added additional authorization failure codes into reply.
-
#168 Added additional not master checks in replica set reconfiguration.
-
#156 Collection#drop will raise on any error other than collection does not exist. (Daniel Doubrovkine)
-
#152 Added
errmsg
"not master" to replica set configuration check. (Christos Trochalakis) -
#151 Dropping collections now always uses primary. (Christos Trochalakis)
-
#150 Handle cases where Mongo does not bring back a
query_failure
flag in the reply, but has an error document present. -
mongoid/mongoid#2849 Supply proper limit to initial query if either limit or batch_size are provided.
-
mongoid/mongoid#2831 Fix node refresh when no peers exist.
- #148 Fixed invalid parameters passed when raising a
ReplicaSetReconfigured
exception.
-
#144 Moped now supports $maxScan options in queries. (Jonathan Hyman)
session[:bands].find(name: "Blur").max_scan(50)
-
#143 Aggregation pipeline commands no longer force to read from primary.
-
#141 Timeouts on sockets are now set to the timeout level provided, as well is active checks now happen before sending both reads and writes.
-
#140 Nodes that were provided to Moped's session in intialization, that were removed from the replica set but still alive and accepting connections will no longer be in the list of available nodes.
-
#138 Aggregation pipeline now supports array or splat args. (Gosha Arinich)
-
#41
Moped::BSON::ObjectId.from_time
now accepts aunique
option to ensure the generated id is unique.Moped::BSON::ObjectId.from_time(time, unique: true)
-
mongoid/mongoid#2452 A boolean can now be passed to count to determine if the skip and limit options should be included in the value.
session[:bands].find(name: "Blur").skip(10).limit(5).count(true)
-
#137
IOError
exceptions during connection go through reconnect process properly. (Peter Kieltyka) -
#120 Return UTF-8 strings when calling
ObjectId#to_s
. -
mongoid/mongoid#2738 Ensure that delete operations don't include special selectors, like $query.
-
mongoid/mongoid#2713 Allow collections that have names that start with "system" to be returned by
Database#collection_names
.
-
#131 Give better error messages when assertion and assertionCode are present in the result.
-
#130 Flag down as down in refresh when not primary or secondary. (Nilson Santos Figueiredo Jr)
-
#128 Fix refresh check to only check nodes that have been down longer than the refresh boundary using the proper interval.
-
#125 Batch size and no timeout are now respected by queries. (Derek Buttineau)
-
#124 Fix packing of bytes in core messages for big endian systems.
-
#118 Give better error when invalid URI is provided. (Chris Winslett)
-
#116 Handle all cases of replica set step down or reconfiguring. (Chris Winslett)
-
Change the default retries to 20 and the retry interval to 0.25 seconds. (Old was 30/1)
-
#114 Moped now accepts connecting with a URI. (Christopher Winslett)
Moped::Session.connect("mongodb://localhost:27017/my_db")
-
#79 Tailable cursors are now supported. These are just Ruby
Enumerators
that keep the cursor open until the next document appears. The cursor will be closed when it becomes "dead".enumerator = session[:users].find.tailable.each enumerator.next # Will stay open until next doc.
-
mongoid/mongoid#2460 Moped now makes the connection timeout configurable by passing a
:timeout
option to the session. This defaults to 5 seconds.Moped::Session.new([ "node1:27017", "node2:27017" ], timeout: 5)
-
#49 Support for the 2.2 aggregation framework is included. (Rodrigo Saito)
session[:users].aggregate({ "$group" => { "_id" => "$city", "totalpop" => { "$sum" => "$pop" } } })
-
#42 Moped now supports SSL connections to MongoDB. Provide the
ssl: true
option when creating a newSession
. This is currently experimental.Moped::Session.new([ "ssl.mongohq.com:10004" ], ssl: true)
-
#110 Handle timeout errors with SSL connections gracefully and mark nodes as down without failing any other queries.
-
#109 Moped reauthorizes on "db assertion failures" with commands that have an unauthorized assertion code in the reply.
- Moped now ensures that when reading bytes from the socket that it continues
to read until the requested number of bytes have been received. In the case
of getting
nil
back it will raise aConnectionFailure
and go through the normal failover motions.
-
#108 Connection drops that would result in a
nil
response on socket read or aSocketError
now re-raise aConnectionFailure
error which causes the replica set to go through it's failover behavor with node refreshing. -
#104
Query#explain
now respects limit. -
#103 Port defaults to 27017 instead of zero if not provided. (Chris Winslett)
-
#100 Fix duplicate object id potential issue for JRuby. (Tim Olsen)
-
#97 Propagate node options to newly discovered nodes. (Adam Lebsack)
-
#91 Added more graceful replica set handling when safe mode is enabled and replica sets were reconfigured. (Nicolas Viennot)
-
#90 Include arbiters in the list of nodes to disconnect. (Matt Parlane)
-
#87
Moped::BSON::ObjectId.legal?
now returns true for object ids. -
#85 Allow
===
comparisons with object ids to check for equality of the underlying string. (Bob Aman) -
#84 Query hints are no longer wiped on explain.
-
#60/#80 Moped now gracefully handles replica set reconfig and crashes of the primary and secondary. By default, the node list will be refreshed every second and the operation will be retried up to 30 times. This is configurable by setting the
:max_retries
and:retry_interval
options on the session.Moped::Session.new( [ "node1:27017", "node2:27017" ], retry_interval: 0.5, max_retries: 45 )
- mongoid/mongoid#2430 Don't include $orderby criteria in update calls.
-
#76 Fixed typo in database check on Node. (Mathieu Ravaux)
-
#75 Ensure that
Errno::EHOSTUNREACH
is also handled with other socket errors.
-
#73 Raise a
Moped::Errors::CursorNotFound
on long running queries where the cursor was killed by the server. (Marius Podwyszynski) -
#72 Reauthenticate properly when an
rs.stepDown()
occurs in the middle of cursor execution. -
#71 When DNS cannot resolve on node initialization, the node will be flagged as down instead of raising a
SocketError
. On subsequent refreshes Moped will attempt to resolve the DNS again to determine if the node can be brought up.
-
#63
Database#collection_names
now returns collections with "system" in the name that aren't core MongoDB system collections. (Hans Hasselberg) -
#62 Ensure
Connection#alive?
returns false if I/O errors occur. (lowang) -
#59 Use the current database, not admin, for
getLastError
commands. (Christopher Winslett) -
#57 Ensure collection name is a string for all operations.
-
#50 Fixed connection issues when connection is disconnected mid call. (Jonathan Hyman)
-
mongoid/mongoid#2251 Allow
continue_on_error
option to be provided to inserts. -
mongoid/mongoid#2210 Added
Session#disconnect
which will disconnect all nodes in the cluster from their respective database servers. Useful for cases where a large number of database connections are being created on separate threads and need to be explicitly closed after their work is completed. -
#33 Added
Session#databases
andSession#database_names
as a convenience for getting all database information for the server.session = Moped::Session.new([ "localhost:27017" ]) session.database_names #=> [ "moped_test" ] session.databases #=> { "databases" => [{ "name" => "moped_test" }]}
-
#45 When providing database names with invalid characters in them, Moped will now raise an
InvalidDatabaseName
error. -
#41
ObjectId.from_time
now only includes the timestamp, no machine or process information.
-
#44 Fixed order of parameters for loading timestamps. (Ralf Kistner)
-
#40 Fix explain to return correct number of scanned documents and time.
- Queries now can be duped/cloned and be initialized properly.
- #37 Use
TCP_NODELAY
for socket options. (Nicolas Viennot)
- mongoid/mongoid#2175 Fixed sorting by object ids.
- #29 Fixed endian directives order. Moped will now work properly on all architectures. This removes support for MRI 1.9.2. (Miguel Herranz)
-
mongoid/mongoid#2175 Fixed sorting by object ids.
-
#28
BSON::Binary
andBSON::ObjectId
now have readableto_s
andinspect
methods. (Ara Howard)