Improve cursorData struct unmarshaling speed by bozaro · Pull Request #49 · globalsign/mgo (original) (raw)

domodwyer added a commit that referenced this pull request

Nov 6, 2017

@domodwyer

Create a new method to drop all the indexes of a collection in a single call

fix #484

Annotate connections with metadata provided by the connecting client.

informations send:

{ "aplication": { // optional "name": "myAppName" } "driver": { "name": "mgo", "version": "v2" }, "os": { "type": runtime.GOOS, "architecture": runtime.GOARCH } }

to set "application.name", add appname param in options of string connection URI, for example : "mongodb://localhost:27017?appname=myAppName"

Fix #30.

Thanks to @feliixx for the time and effort.

If all tests pass, the builds for mongo earlier than 2.6 are still failing. Running a clean up fixes the issue.

See:

fix #29

fixes #31

Fixes #43

Original issue

You can't use type with custom GetBSON() method mixed with structure field type and structure field reference type.

For example, you can't create custom GetBSON() for Bar type:

struct Foo {
    a  Bar
    b *Bar
}

Type implementation (func (t Bar) GetBSON() ) would crash on Foo.b = nil value encoding.

Reference implementation (func (t *Bar) GetBSON() ) would not call on Foo.a value encoding.

After this change

For type implementation func (t Bar) GetBSON() would not call on Foo.b = nil value encoding. In this case nil value would be seariazied as nil BSON value.

For reference implementation func (t *Bar) GetBSON() would call even on Foo.a value encoding.

This change remove full BSON decoding on:

fix #51