Skip to content

MongoDB Go Driver Beta 3

Pre-release
Pre-release
Compare
Choose a tag to compare
@skriptble skriptble released this 01 Feb 17:28
· 1351 commits to master since this release

The MongoDB Go driver team is pleased to release the third and final beta release of the official Go driver.

This release changes the API for cursor, numerous documentation updates and fixes, and other small API changes.

Documentation can be found on GoDoc and the MongoDB documentation site. Questions and inquiries can be asked on the mongo-go-driver Google Group. Bugs can be reported in the Go Driver Jira where a list of current issues can be found.

Cursor and ChangeStream API changed

This release changes the mongo.Cursor type from an interface to a struct and adds a mongo.ChangeStream struct type which is returned from Watch methods. The DecodeBytes method on each has been replaced with a struct level property called Current. The bson.Raw bytes of this property are only valid until the next call to Next or Close on the Cursor or ChangeStream.

Previous usage:

var cur mongo.Cursor
for cur.Next(context.TODO()) {
    rdr, err := cur.DecodeBytes()
    if err != nil {
        return err
    }
    // Do something with rdr
}

New usage:

var cur *mongo.Cursor
for cur.Next(context.TODO()) {
    rdr := cur.Current
    // Do something with rdr
}

Release Notes

Bug

  • [GODRIVER-743] - UpdateOne and UpdateMany should return error when update parameter is of zero length
  • [GODRIVER-746] - ChangeStream Next doesn't getMore after error case
  • [GODRIVER-756] - Incorrect formatting of numbers with exponents in JSON
  • [GODRIVER-757] - README out of date WRT using nil in Find
  • [GODRIVER-769] - Remove use of internal package from connstring package
  • [GODRIVER-784] - GridFS RoundTrip test fails with race detector on
  • [GODRIVER-791] - Panic on cursor Close with a dead server

New Feature

  • [GODRIVER-400] - reorder conditionals to return write errors if a write concern error is also present.
  • [GODRIVER-758] - options.Collation is missing Normalization

Task

Improvement

  • [GODRIVER-3] - Change driver.Cursor to be a batch cursor
  • [GODRIVER-704] - Document that mongo.SessionContext is not goroutine safe
  • [GODRIVER-707] - method/operation to determine if a write error is a duplicate key error
  • [GODRIVER-713] - Remove string key restriction for Encoder and Decoder lookups
  • [GODRIVER-714] - KeepAlive is not enabled by default
  • [GODRIVER-717] - IntEncodeValue should encode int's within 32bits as int32s
  • [GODRIVER-733] - Add diagnostic information to server selection errors
  • [GODRIVER-751] - Incorrect example in godoc website
  • [GODRIVER-753] - Change GridFS implementation to not have partial chunks
  • [GODRIVER-759] - Make Cursor a struct and make changeStream public
  • [GODRIVER-764] - bulk write operation dependencies
  • [GODRIVER-772] - README requirements section still lists v3.2 as minimum version
  • [GODRIVER-781] - Inconsistent use of time.Duration and int64 in options