top | item 10260429

(no title)

diverightin63 | 10 years ago

So, one thing holding me back from using MongoDB (and thus Meteor) is a lack of understanding how schema can be managed.

Say in MongoDB you are storing documents in a collection such as { property: "" }, and decide you want to change that to { property2: "" }. Does that mean you have to script a change to every document to convert these objects?

discuss

order

hereandthere2|10 years ago

in this case "renaming a field" it would be something like

`Collection.rename('property', 'property2')`

my syntax may be slightly off since i mostly use mongo thru a ruby orm but the basic idea is the same.

we handle these things by having a tasks we run each deployment (named after the deployment version) with the necessary db changes.

coldtea|10 years ago

That's not data management. That's schema management (migration).

And yes, you have to script a change to every document.

diverightin63|10 years ago

Right. And I see. Are these managed by something like migrations?

djmashko2|10 years ago

As far as I know, this is an issue for every database, no? What are you currently using?

X-Istence|10 years ago

Except that in every other database a migration like that changes a column, that's it.

In MongoDB you have to manually walk all your objects and migrate them.

diverightin63|10 years ago

Well, in relational SQL you would just do an ALTER on the column name.