Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
04-26-2014, 09:26 PM #1
- Join Date
- Jun 2008
- New Jersey
- Thanked 259 Times in 256 Posts
Advice on equivilent Mongo schema from MySQL
So I started learning Mongo a week or two back, and I'm looking at its applications in various projects I already have up, trying to figure out methods/schemas for Mongo. After years with MySQL, I'm so used to things like normalization and joins that Mongo is throwing me for a bit of a loop. I'm hoping I can get some advice on a particular problem that may help me figure some stuff out.
So one of my projects is a game site for pen and paper games. In most games, characters have skills, and many skill names persist across games. In MySQL, I have a skills table that has the name of the skill and an ID, and then a table per game that takes that ID and a characterID to assign a skill. Then its a simple case of joining to get a character's skills. In addition, I have some AJAX calls, for example, an autocomplete that doesn't return skills the character already has.
So I'm hoping for some advice as to how to do this with Mongo. My first thought was a collection of skills, and then have the characters skills as an array within the character's object (there is a character collection). If I store the skillID in the character collection, then I have to do a second query to grab the skill names, if I don't, and I need to update a skill name, I have to update every character object. Additionally, when I do the autocomplete, I would need to get the character object and do a server side comparison.
I guess I'm just looking for some advice on how to tackle a problem like this, and if anyone knows a book that might be good for me to learn Mongo schemas.