A cautionary tale - mgo asserts

John Meinel john at arbash-meinel.com
Wed Jun 8 10:36:27 UTC 2016


>
> ...
>


>
>   ops := []txn.Op{{
>       C: "collection",
>       Id: ...,
>       Assert: bson.M{
>           "some-field.A": "foo",
>           "some-field.B": 99,
>       },
>       Update: ...
>   }
>
> ...
>
>

> [1] If transaction operations are loaded and used from the DB (more likely
> under load when multiple runners are acting concurrently), the Insert,
> Update and Assert fields are loaded as bson.M (this is what the bson
> Unmarshaller does for interface{} typed fields). Once this happens field
> ordering is lost.
>
> If loading into a bson.M is the problem, wouldn't using a bson.M to start
with also be a problem?

John
=:->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20160608/6f435ee5/attachment-0001.html>


More information about the Juju-dev mailing list