Cleansing Mongo data
Katherine Cox-Buday
katherine.cox-buday at canonical.com
Fri Jun 24 16:02:22 UTC 2016
Thanks Menno, I'll get that docstring corrected!
I'm not sure it needs to be in its own package. I put it there because the taxonomy made sense in my head, and I get the impression that we have built up a lot of utility-like functions for Mongo over time, but YAGNI may apply here.
I don't plan on moving this over (mostly due to time constraints), but I would not be opposed if someone wanted to. It might be helpful to inventory other utility-like functionality first.
Menno Smits <menno.smits at canonical.com> writes:
> Thanks, this is really useful - especially when writing data into the
> database that comes sources that the code doing the writing doesn't
> have control over.
>
> Two little things:
>
> 1. The docstring for EscapeKeys still mentions statusDoc.
> 2. Are you sure this needs to be in it's own package, especially one
> called "utils"? Given we already have the widely used
> github.com/juju/utils - as well as others with that name under
> juju/juju - this one is predestined to be aliased everywhere it's
> imported. Couldn't these escaping functions just live in their own
> file in github.com/juju/juju/mongo? Even when the import isn't
> aliased, the intent of "mongo.EscapeKeys(...)" is clearer than
> "utils.EscapeKeys(...)".
>
> - Menno
>
> On 24 June 2016 at 08:09, Katherine Cox-Buday
> <katherine.cox-buday at canonical.com> wrote:
>
> Hey all,
>
>
> William gave me a good review and it came up that I wasn't
> cleansing some of the data being placed in Mongo. I wasn't aware
> this had to be done, and after talking to a few other folks it
> became apparent that maybe not many people know we should be doing
> this.
>
>
> At any rate, William also pointed me to some existing code which
> did this. I've pulled it out into the mongo/utils package for
> general consumption. The comments do a pretty good job of
> elucidating why this is necessary.
>
>
> https://github.com/juju/juju/blob/master/mongo/utils/data_cleansing.go
>
>
>
>
> -
> Katherine
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
>
>
>
--
Katherine
More information about the Juju-dev
mailing list