1. End-to-End Feature Development with MongoDB Atlas
  2. MongoDB Stitch Serverless Functions
  3. Query MongoDB via Frontend with Stitch
  4. MongoDB Cloud: Backend as a Service with Atlas & Stitch

At times, I’ve found my opinion of MongoDB Atlas and MongoDB Stitch to waver between two extremes. Sometimes I’m struck by the allure of a cloud which fundamentally disregards schemas (wooo no schema party!). Other times, such as when Mongo decides to upgrade to a new version and you find all your production instances broken, I like the ecosystem a bit less.

My biggest qualm with MongoDB is poor documentation. The “tutorials” and sample code seems hacked-together, unmaintained, and worst of all, inconsistent with itself. Reading through the docs seems to always end up with Mongo forcing Twilio down my throat my for some miserable reason.

Just to illustrate how bad things can get, below are two totally sets of documentation for what is supposed to be the same product. Mongo’s main documentation on the left frequently references the bastardized documentation on the right. What is the documentation on the right? It’s a collection of nonsense living on an S3 bucket which lists the methods black-boxed into Stitch, often with zero explanation on how to actually utilize functionality.

Which one is real? And WHY?!

How frustrating is this? I’ve had email user authentication “working” for weeks as far as Stitch’s logs say, although not a single user has actually been registered in that time. Anyways, I digress.

Making a Serverless Function

Stitch Serverless functions are of course strictly Javascript (MongoDB abides by ECMA2015 features). In your Stitch console, check out the “functions” link in the left hand nav:

!Go ahead and create a new function.

There are just a few things we need to specify when creating a new function:

  • The name of the function (duh).
  • Whether or not the function can be accessed “publicly”. A “Private” function is the equivalent of a function that only accessible to the VPC it belongs to (although technically MongoDB Cloud doesn’t use this terminology).
  • A condition which needs to be met in order for the function to execute.

#nosql #frontend #javascript #data engineering

MongoDB Stitch Serverless Functions
1.25 GEEK