5 ms·
Thank you for your very detailed and good response. I actually have a lot of experience with relational databases, much more than with NoSQL. The thing with th
by Kiro 9y ago
Thank you for your very detailed and good response. I actually have a lot of experience with relational databases, much more than with NoSQL.
The thing with the users collection is that I need to be able to add any arbitrary attribute to the user document so I can't really use a table with a schema. I guess I could use a related key value table for those but the attributes can be anything, nested objects and arrays. Maybe serializing the value would work but it still seem that Mongo is a better fit in that case.
I also like seeing the user document as a big JSON without joins when doing DB admin stuff.
- perlgeek 9y ago> The thing with the users collection is that I need to be able to add any arbitrary attribute to the user document so I can't really use a table with a schema. You could put the attributes that all users share (username, email address, maybe hashed password) in a table, and then have a jsonb or hstore field for the rest of the attributes. That way you can still programmatically access the elements, and even build indexes over them. But if you have no real reason to change DB, don't.
- Kiro 9y agoThat's a good idea. Thanks.
- 6nf 9y ago> I need to be able to add any arbitrary attribute to the user document so I can't really use a table with a schema. I'd love to see a sample of this data
- deleted 9y ago[deleted]
- Kiro 9y agoIt's not your usual CRUD app. It's a realtime sandbox game in early access. Some arbitrary stuff I keep adding for various reasons: gunsLeftToCompensateDueToChangeInVersionX: 123, winnerOfEventX: true, didSomethingFunky: Date.now(), noOfEnemiesKilledBeforeVersionY: 123, inventory: [{id: GENERIC_ITEM_ID, quantity: 123}, {id: uuid, name: "Ultimate Weapon", damage: 10000, someUniqueProp: {doThis: true, uses: 123}}], flaggedForCheatingInThisOrThatArena: true Etc etc. Biggest reason though is just convenience of adding some state to the player when developing new features. Itt would be a complete pain having to add schemas for every single situation, even if it's standardised for all players. Now I just add it to the player object and it's saved automatically to the player document. Not saying what I do is best practice or anything but it enables me to move fast without having to do much DB admin stuff.