Conway's Game of Life Just Using Mongo Shell

conwaygol

It really surprises me the number of people who don’t know how the mongo shell works. Most of the people I see seem to think it’s just db.find()s or db.aggregate()s with some print statements. The mongo shell is interesting because it’s fundamentally different from your regular SQL editor, where you can’t declare a variable or write a loop. But the mongo shell is so much more than just MongoDB functions. It’s a full JavaScript runtime built on Node.js, with variables, functions, closures, classes, and so much more. Your database is just an object sitting inside it.

In this article, I want to show the perspective of not just using the MongoDB functions in the mongo shell, but actually using the full potential of the shell, with examples like Conway’s Game of Life and some custom chart diagrams. I wanted to show what lies beyond db.finds, db.updates, or db.aggregates that could be applicable in your day-to-day work with MongoDB! I hope you enjoy the rest of the article!

Read the full article here

3 Likes

Great article! It’s a good reminder that the MongoDB shell is a full JavaScript runtime, not just a place to run queries. Examples like Conway’s Game of Life really highlight how powerful and flexible it can be.

1 Like

Thank you, I’m glad you liked it!