Concept: Is mongo right for applying schemas?

Posted by Jan on Stack Overflow See other posts from Stack Overflow or by Jan
Published on 2012-03-30T13:20:09Z Indexed on 2012/03/31 11:29 UTC
Read the original article Hit count: 207

I am currently in charge of checking wether it is valuable for one of our upcoming products to be developed on mongo.

Without going too much into detail, I'll try to explain, what the app does.

The app simply has "entities". These entities are technical stuff, like cell phones, TVs, Laptops, tablet pcs, and so forth.

Of course, a cell phone has other attributes than a Tablet PCs and a Laptop has even other attributes, like RAM, CPU, display size and so on.

Now I want to have something that we wanna call a scheme: We define that we need to have saved the display size, amount of ram size of flash devices, processor type, processor speed and so on for tablet pcs. For cell phone we might save display size, GSM, Edge, 3g, 4g, processor, ram, touch screen technology, bla bla bla. I think you got it :)

What I want to realize is, that each "category" has a schema and when one of the system's users enters a new product (let's say the new iphone 4), the app constructs the form to be filled out with the appropriate attributes.

So far it sounds nice and should not be a problem with mongo. But now the tough for which I could not find a clean solution....

An attribute modeled in mongo looks like:

{
_id: 1234456, name: "Attribute name", type: 0, "description"
}

But what to do, if i need this attribute in several languages, like:

{
en: {name: "Attribute name", type: 0, "description"},
de: {name: "Name des Attributs, type: 0, "Beschreibung"}
}

I also need to ensure that the german attribute gets updated as soon as the english gets updated, for instance when type changes from 0 to 1.

Any ideas on that?

© Stack Overflow or respective owner

Related posts about mongodb

Related posts about globalization