DEV Community

Cover image for enchantedForest[1]
Kevin Hsu for enchantedForest

Posted on


ipdb> [{blah: doc[blah] for blah in doc if blah != "_id"} for doc in mongo.db.users.find()]

This beautiful, coherent piece of code is what makes up the foundation of our MongoDB back-end.

We've decided on using MongoDB paired with Flask as our back-end to store user data and provide game-state saving. Players will be able to interact with a "monolith" at certain predetermined save points and send their game state in JSON format to our server, which is another reason why we decided to go with MongoDB instead of MySQL.

As Alek said:

"What is MongoDB? So it's like you have a json. And then there is a json inside of that (those are called collections). And then inside of the collection, it's like, there's another json inside of it. And in the json spec, it literally says, if x is a json, then {"x": x} is a json, so you can have jsons all the way down."

(Our server is a Digital Ocean droplet running CentOS 7)

In addition, as a PSA to all other fellow MongoDB beginners out there, please note that database names are case-sensitive (this took us a while to figure out).

Top comments (0)