DEV Community

Cover image for enchantedForest[1]
Kevin Hsu for enchantedForest

Posted on

2 2

enchantedForest[1]

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).

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now