Contemplating MongoDB but...

Rage9

Banned
Jan 7, 2008
6,061
101
0
So I'm working a very large site that is very data heavy. I'm wanting to go with a combo of ruby + MongoDB.

The only reason I'm the slightest hesitant is that unlike MySQL, Mongo doesn't have an auto increment feature. The reason that is important is I anticipate that certain records could have the exact same data that I would match against.

In the past I've done something like: rowid-data-to-match-against.

Mind you this is in the URL for SEO purposes.

Now two decent, but not as easy solutions come to mind.

1) Create a unique slug. For example data-to-match-against-number. number being the iteration.

2) Create my own auto-increment system that uses another table to keep track of all the auto-increment values. Or use a single record in target table to handle keeping track of the auto-increment.

What would you use? One of the two solutions above or something totally different?
 


What would you use? One of the two solutions above or something totally different?

The slug sounds like the better option. The unique integer is a relational database thing, and it sounds like you want to get away from that.

On the topic, though, what about going the SQL route and building a memcache layer in front of it? (If you're planning in being write-bound then mongo's the better choice)

Sean
 
I'm not very familiar with NoSQL systems (so I'm not sure if this is the best approach), but in a former live I worked on AS/400s running DB2.

If I remember correctly we had a table the basically contained 1 field id that we use store store every tables ids in. Then in the application we had it handle the creating and setting of table id fields. Then later I believed we moved to UUIDs.

I would think (but again never messed with a NoSQL system) using an integer even with a global lookup table would save space over the long run.
 
Wait, you mean you haven't coded your own database system? :)

Sadly not yet.

On the topic, though, what about going the SQL route and building a memcache layer in front of it? (If you're planning in being write-bound then mongo's the better choice)

It's been considered, however in the benchmarks I've seen in general Mongo is faster, and when it trails it barely trails. So it kind of seems like a no brainer.
 
The thing that grabbed me after going through the quick tutorial is the ability to define data structures on the fly. Will need to investigate more...