JSON versus ARRAY

The site cookbook for mongodb has the following snippet of code in the readme
file:

Most importantly you need to define what collections should be sharded by setting the attribute mongodb[:sharded_collections]: { "mongodb": { "sharded_collections": { "test.addressbook": "name", "mydatabase.calendar": "date" } } }

Actually, I added this into my recipe via the attributes file using a different
format:

default[:mongodb][:sharded_collections][“test4.addressbook”] = "name"
default[:mongodb][:sharded_collections][“mydatabase.calendar”] = “date”

That methodology seemed to make more sense. To add this into the attributes
file in that format. They are attributes, after all.

My question to the mailing list, what would you consider the standard and
recommended way to apply these attributes? Would you use JSON or an ARRAY,
which file would you place them in, and how would you get them uploaded into
chef. Not what is “possible”, but rather “what is best practice”.

Thanks.

They're both hashes(key-value pairs), only in different languages. Use whatever you like. Attributes, however, are resolved by precedence, so where you put them matters. Wiki has more details.

Sent from my iPhone

On Dec 6, 2012, at 7:12 AM, samuel.d.darwin@gmail.com wrote:

The site cookbook for mongodb has the following snippet of code in the readme
file:

Most importantly you need to define what collections should be sharded by setting the attribute mongodb[:sharded_collections]: { "mongodb": { "sharded_collections": { "test.addressbook": "name", "mydatabase.calendar": "date" } } }

Actually, I added this into my recipe via the attributes file using a different
format:

default[:mongodb][:sharded_collections]["test4.addressbook"] = "name"
default[:mongodb][:sharded_collections]["mydatabase.calendar"] = "date"

That methodology seemed to make more sense. To add this into the attributes
file in that format. They are attributes, after all.

My question to the mailing list, what would you consider the standard and
recommended way to apply these attributes? Would you use JSON or an ARRAY,
which file would you place them in, and how would you get them uploaded into
chef. Not what is "possible", but rather "what is best practice".

Thanks.