On Sun, 11 Nov 2012, Niranjan U wrote:
> I want the second one: {
> "strings" : [ {"this is one string" : 123}, {"another one here" : 432},
> { "This is a sample. Hope it works" : 946} ],
> }
I would store that differently. You should try to never have random
arbitrary keys like you have above. Even though MongoDB is schema less,
I would always take as a guidepoint that I always need to be able to
describe what each *key* means. I would instead store the data like
this:
{
"strings" : [
{
string: "this is one string",
value: 123
},
{
string: "another one here",
value: 432
},
{
string: "This is a sample. Hope it works",
value: 946
}
]
}
cheers,
Derick
--
{
website: [ "
http://mongodb.org", "
http://derickrethans.nl" ],
twitter: [ "@derickr", "@mongodb" ]
}