RFC: mongo "_id" fields in the multi-environment juju server world
Gustavo Niemeyer
gustavo at niemeyer.net
Fri Jul 4 13:56:25 UTC 2014
On Thu, Jul 3, 2014 at 10:01 PM, Tim Penhey <tim.penhey at canonical.com> wrote:
> As far as I know (and I may be wrong), if you are adding a document to
> the mongo collection, and you do not specify an _id field, mongo will
> create a unique value for you.
That's right in most cases, and a requirement for replication.
> 1. change the _id field to be a "composed" field where it is the
> concatenation of the environment id and the existing id or name field.
> If we do take this approach, I strongly recommend having the fields that
> make up the key be available by themselves elsewhere in the document
> structure.
I'd go with this, including your suggestion of splitting the data
apart in proper fields. Sounds straightforward and comfortable to deal
with.
gustavo @ http://niemeyer.net
More information about the Juju-dev
mailing list