Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Getting Started with MongoDB Atlas and Azure Functions using Node.js

So you’re building serverless applications with Microsoft Azure Functions, but you need to persist data to a database. What do you do about controlling the number of concurrent connections to your database from the function? What happens if the function currently connected to your database shuts down or a new instance comes online to scale with demand?

The concept of serverless in general, whether that be through a function or database, is great because it is designed for the modern application. Applications that scale on-demand reduce the maintenance overhead and applications that are pay as you go reduce unnecessary costs.

In this tutorial, we’re going to see just how easy it is to interact with MongoDB Atlas using Azure functions. If you’re not familiar with MongoDB, it offers a flexible document model that can be used to model your data for a variety of use cases and is easily integrated into most application development stacks. On top of the document model, MongoDB Atlas makes it just as easy to scale your database to meet demand as it does your Azure Function.

Read More

Build a Totally Serverless REST API with MongoDB Atlas

So you want to build a REST API, but you don’t want to worry about the management burden when it comes to scaling it to meet the demand of your users. Or maybe you know your API will experience more burst usage than constant demand and you’d like to reduce your infrastructure costs.

These are two great scenarios where a serverless architecture could benefit your API development. However, did you know that the serverless architecture doesn’t stop at just the API level? You could make use of a serverless database in addition to the application layer and reap the benefits of going totally serverless.

In this tutorial, we’ll see how to go totally serverless in our application and data development using a MongoDB Atlas serverless instance as well as Atlas HTTPS endpoints for our application.

Read More

Developing Your Applications More Efficiently with MongoDB Atlas Serverless Instances

If you’re a developer, worrying about your database is not necessarily something you want to do. You likely don’t want to spend your time provisioning or sizing clusters as the demand of your application changes. You probably also don’t want to worry about breaking the bank if you’ve scaled something incorrectly.

With MongoDB Atlas, you have a few deployment options to choose from when it comes to your database. While you could choose a pre-provisioned shared or dedicated cluster, you’re still stuck having to size and estimate the database resources you will need and subsequently managing your cluster capacity to best fit demand. While a pre-provisioned cluster isn’t necessarily a bad thing, it might not make sense if your development becomes idle or you’re expecting frequent periods of growth or decline. Instead, you can opt for a serverless instance to help remove the capacity management burden and free up time to dedicate to writing code. Serverless instances provide an on-demand database endpoint for your application that will automatically scale up and down to zero with application demand and only charge you based on your usage.

In this short and sweet tutorial, we’ll see how easy it is to get started with a MongoDB Atlas serverless instance and how to begin to develop an application against it.

Read More

Randomizing MongoDB Document Fields on a Repeating Timer with Node.js

About a year ago I created a game with MongoDB and Unity and wrote about it in a previous tutorial. The idea was to demonstrate how features within the game could be synchronized to each player in near real-time. At the time, synchronization happened through a web dashboard where the player could select features to sync and they would then sync to the game client, wherever in the world it might be.

Recently, the game was adopted to be a demo at several conferences. The problem was that switching between the game and the web dashboard to demonstrate features being synchronized was a hassle. As a result, I decided to write a script that did this automatically on a timer.

In this quick tutorial, we’re going to see how to update documents within MongoDB on a timer, something that might be useful to you for demos and other potential use-cases.

Read More

Interact with a GraphQL API from a .NET Core Application

When it comes to C#, it’s not too difficult or time-consuming to create or consume RESTful APIs. In fact, I recently published a tutorial that demonstrated how to create a RESTful API with .NET Core using MongoDB as the NoSQL database.

RESTful APIs are great, but what happens when you want to work with GraphQL and query your APIs rather than just consume them?

In this tutorial, we’ll see how to use .NET Core to interact with a GraphQL API. To make things easier, we’ll generate our API with MongoDB App Services.

Read More

Developing a Web Application with Netlify Serverless Functions and MongoDB

As I mentioned in a previous tutorial, I’m a big fan of Netlify and the services they offer developers—my favorite of their services being their static website hosting and serverless functions. When combining the two, you can deploy a complex website or web application with a back end, without ever worrying about infrastructure or potentially complex API design.

So how does that work with a database like MongoDB?

If you’ve ever dabbled with serverless functions before, you might be aware that they are not always available for consumption. Many serverless functions exist for a defined amount of time and then are shut down until they are executed again. With this in mind, the connection to a database might not always be available like it would be in an application built with Express Framework, for example. You could establish a connection every time a function is called, but then you risk too many connections, which might overload your database.

So what do you do?

In this tutorial, we’re going to see how to build and deploy a simple web application using Netlify Functions and MongoDB Atlas. For this particular tutorial, we’ll be using the Node.js driver for MongoDB, but both Netlify and MongoDB support the use of other languages and drivers as well.

Read More

Intro to SQL for the New Grad Developer

Ever since studying and working with databases 6 months ago, I’ve become fascinated with SQL and its relatively simple syntax. As a guide to the reader, I’ve gathered the essential criteria that employers expect you to know when applying for a database-related job.

In this blog, I will cover what SQL is, its different flavors and syntactical differences centered around an example query, the importance of EXPLAIN and SQL query runtime, and finally some example problems specifically in MySQL.

Read More