Document Databases: Redundant data, references, etc. (MongoDB specifically)

There are basically two scenario’s: fresh and stale. Fresh data Storing duplicate data is easy. Maintaining the duplicate data is the hard part. So the easiest thing to do is to avoid maintenance, by simply not storing any duplicate data to begin with. This is mainly useful if you need fresh data. Only store the … Read more

Choosing MongoDb/CouchDb/RavenDb – performance and scalability advice [closed]

if “20,000 concurrent writes” means inserts then I would go for CouchDB and use “_changes” api for triggers. But with 20.000 writes you would need a stable sharding aswell. Then you would better take a look at bigcouch And if “20.000” concurrent writes consist “mostly” updates I would go for MongoDB for sure, since Its … Read more

How to organise a many to many relationship in MongoDB

What I’ve seen done, and what I currently use are embedded arrays with node id’s in each document. So document user1 has property groups: [id1,id2] And document group1 has property users: [user1]. Document group2 also has property users: [user1]. This way you get a Group object and easily select all related users, and the same … Read more

Pros/cons of document-based databases vs. relational databases

You need to think of how you approach the application in a document oriented way. If you simply try to replicate how you would model the problem in an RDBMS then you will fail. There are also different trade-offs that you might want to make. ([ed: not sure how this ties into the argument but:] … Read more

Using git repository as a database backend

Answering my own question is not the best thing to do, but, as I ultimately dropped the idea, I’d like to share on the rationale that worked in my case. I’d like to emphasize that this rationale might not apply to all cases, so it’s up to architect to decide. Generally, the first main point … Read more

Delete a key from a MongoDB document using Mongoose

In early versions, you would have needed to drop down the node-mongodb-native driver. Each model has a collection object that contains all the methods that node-mongodb-native offers. So you can do the action in question by this: User.collection.update({_id: user._id}, {$unset: {field: 1 }}); Since version 2.0 you can do: User.update({_id: user._id}, {$unset: {field: 1 }}, … Read more