A field retrieval performance question

0 views
Skip to first unread message

Voltron

unread,
Dec 15, 2009, 7:37:03 AM12/15/09
to mongodb-user
I am storing language maps in documents. Each document represents a
certain language. I have thought of 2 ways to scheme the data

The mapped data as fields as in

doc_a = {
'hello' : 'hallo',
''goodbye': ''Auf wiedersehen,

}

or

map_de = {
'hello' : 'hallo',
''goodbye': ''Auf wiedersehen,

}

The mapped data as a dict in one field
doc_b ={
map : map_de,
}

The map data has about 200 entries, what schema would be advisable?

Thanks

wwww

unread,
Dec 15, 2009, 7:54:17 AM12/15/09
to mongodb-user
depends how do you use the data

Nicolas Clairon

unread,
Dec 15, 2009, 9:31:58 AM12/15/09
to mongod...@googlegroups.com
You can do something like that :

doc_a = {
"title":{
"en" : "My Document",
"fr" : "Mon Document",
"eo" : "Mia Dokumento",
}
}

But like wwww said, it depends of how you use the data.


2009/12/15 wwww <heqd...@gmail.com>:
> --
>
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>
>

Voltron

unread,
Dec 15, 2009, 3:31:48 PM12/15/09
to mongodb-user
Why should it depend on how Im using the data? The documents are
simple language maps. I m translating short strings in real-time. I am
using the method you have described above for larger blocks of strings
with versioning Nicolas. I think that schema would be too complicated
for short default strings.

Thanks

On Dec 15, 3:31 pm, Nicolas Clairon <clai...@gmail.com> wrote:
> You can do something like that :
>
> doc_a = {
> "title":{
> "en" : "My Document",
> "fr" : "Mon Document",
> "eo" : "Mia Dokumento",
> }
>
> }
>
> But like wwww said, it depends of how you use the data.
>
> 2009/12/15 wwww <heqd2...@gmail.com>:

Eliot Horowitz

unread,
Dec 15, 2009, 9:11:50 PM12/15/09
to mongod...@googlegroups.com
there are 2 real choices
{ _id : <language> , words : { "hello" : "hallo" , .... } }
or
{ _id : "hello" , words : { "german" : "hallo" } }

the benefit of the first is you just have to do a single _id lookup at
the beginning of the request and load all the translations for the
entire page.

the benefit of the 2nd is that its easier to build an admin interface i think.


2009/12/15 wwww <heqd...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages