EventGet 50% off your ticket to MongoDB.local NYC on May 2. Use code Web50!Learn more >>
MongoDB Developer
MongoDB
plus
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right
Productschevron-right
MongoDBchevron-right

Neurelo and MongoDB: Getting Started and Fun Extras

Anaiya Raisinghani, Guru Kamat6 min read • Published Feb 07, 2024 • Updated Feb 22, 2024
NeureloMongoDB
Facebook Icontwitter iconlinkedin icon
Rate this tutorial
star-empty
star-empty
star-empty
star-empty
star-empty
Ready to hit the ground running with less code, fewer database complexities, and easier platform integration? Then this tutorial on navigating the intersection between Neurelo and MongoDB Atlas is for you.
Neurelo is a platform that utilizes AI, APIs, and the power of the cloud to help developers better interact with and manipulate their data that is stored in either MongoDB, PostgreSQL, or MySQL. This straightforward approach to data programming allows developers to work with their data from their applications, improving scalability and efficiency, while ensuring full transparency. The tutorial below will show readers how to properly set up a Neurelo account, how to connect it with their MongoDB Atlas account, how to use Neurelo’s API Playground to manipulate a collection, and how to create complex queries using Neurelo’s AI Assist feature.
Let’s get started!

Prerequisites for success

The set-up

Step 1: MongoDB Atlas Cluster

Our first step is to make sure we have a MongoDB Atlas cluster ready — if needed, learn more about how to create a cluster. Please ensure you have a memorable username and password, and that you have the proper network permissions in place. To make things easier, you can use 0.0.0.0 as the IP address, but please note that it’s not recommended for production or if you have sensitive information in your cluster.
Once the cluster is set up, load in the MongoDB sample data. This is important because we will be using the sample_restaurants database and the restaurants collection. Once the cluster is set up, let’s create our Neurelo account if not already created.

Step 2: Neurelo account creation and project initialization

Access Neurelo’s dashboard and follow the instructions to create an account. Once finished, you will see this home screen.
Neurelo home screen
Initialize a new project by clicking the orange “New” button in the middle of the screen. Fill in each section of the pop-up.
The Organization name is automatically filled for you but please pick a unique name for your project, select the Database Engine to be used (we are using MongoDB), select the language necessary for your project (this is optional since we are not using a language for this tutorial), and then fill in a description for future you or team members to know what’s going on (also an optional step).
Project screen in Neurelo
Once you click the orange “Create” button, you’ll be shown the three options in the screenshot below. It’s encouraged for new Neurelo users to click on the “Quick Start” option. The other two options are there for you to explore once you’re no longer a novice.
Screenshot with options to start your Neurelo journey
You’ll be taken to this quick start. Follow the steps through.
Screenshot with the Quick Start option
Click on “Connect Data Source.” Please go to your MongoDB Atlas cluster and copy the connection string to your cluster. When putting in your Connection String to Neurelo, you will need to specify the database you want to use at the end of the string. There is no need to specify which collection.
Since we are using our sample_restaurants database for this example, we want to ensure it’s included in the Connection String. It’ll look something like this:
Screenshot of where to put our data source
Once you’re done, click “Test Connection.” If you’re unable to connect, please go into MongoDB Atlas’ Network permissions and copy in the two IP addresses on the New Data Source screen as it might be a network error. Once “Test Connection” is successful, hit “Submit.”
Now, click on the orange “New Environment” button. In Neurelo, environments are used so developers can run their APIs (auto-generated and using custom queries) against their data. Please fill in the fields.
Screenshot of an environment in Neurelo
Once your environment is successfully created, it’ll turn green and you can continue on to creating your Access Token. Click the orange “New Access Token” button. These tokens grant the users permission to access the APIs for a specific environment.
Screenshot of creating an Access Token
Store your key somewhere safe — if you lose it, you’ll need to generate a new one.
The last step is to activate the runners by clicking the button.
And congratulations! You have successfully created a project in Neurelo.

Step 3: Filtering data using the Neurelo Playground

Now we can play around with the documents in our MongoDB collection and actually filter through them using the Playground.
In your API Playground “Headers” area, please include your Token Key in the X-API-KEY header. This makes it so you’re properly connected to the correct environment.
Where to put API Key to access the playground
Now you can use Neurelo’s API playground to access the documents located in your MongoDB database.
Let’s say we want to return multiple documents from our restaurant category. We want to return restaurants that are located in the borough of Brooklyn in New York and we want those restaurants that serve American cuisine.
To utilize Neurelo’s API to find us five restaurants, we can click on the “GET Find many restaurants” tab in our “restaurants” collection in the sidebar, click on the Parameters header, and fill in our parameters as such:
Your response should look something like this:
As you can see from our output, the select feature maps to our MongoDB $project operator. We are choosing which fields from our document to show in our output. The filter feature mimics our $match operator and the take feature mimics our $limit operator. This is just one simple example, but the opportunities truly are endless. Once you become familiar with these APIs, you can use these APIs to build your applications with MongoDB.
Neurelo truly allows developers to easily and quickly set up API calls so they can access and interact with their data.

Step 4: Complex queries in Neurelo

If we have a use case where Neurelo’s auto-generated endpoints do not give us the results we want, we can actually create complex queries very easily in Neurelo. We are able to create our own custom endpoints for more complex queries that are necessary to filter through the results we want. These queries can be aggregation queries, find queries, or any query that MongoDB supports depending on the use case. Let’s run through an example together.
Access your Neurelo “Home” page and click on the project “Test” we created earlier. Then, click on “Definitions” on the left-hand side of the screen and click on “Custom Queries.”
Custom queries in Neurelo
Click on the orange “New” button in the middle of the screen to add a new custom query endpoint and once the screen pops up, come up with a unique name for your query. Mine is just “complexQuery.”
With Neurelo, you can actually use their AI Assist feature to help come up with the query you’re looking for. Built upon LLMs, AI Assist for complex queries can help you come up with the code you need.
Where to find Neurelo AI Assist
Click on the multicolored “AI Assist” button on the top right-hand corner to bring up the AI Assist tab.
Type in a prompt. Ours is: “Please give me all restaurants that are in Brooklyn and are American cuisine.”
The complex query shown by the AI Assistant
You can also update the prompt to include the projections to be returned. Changing the prompt to “get me all restaurants that are in Brooklyn and serve the American cuisine and show me the name of the restaurant” will come up with something like:
AI Assist
As you can see, AI Assist comes up with a valid complex query that we can build upon. This is incredibly helpful especially if we aren’t familiar with syntax or if we just don’t feel like scrolling through documentation.
Edit the custom query to better help with your use case.
Click on the “Use This” button to import the query into your Custom Query box. Using the same example as before, we want to ensure we are able to see the name of the restaurant, the borough, and the cuisine. Here’s the updated version of this query:
Click the orange “Test Query” button, put in your Access Token, click on the environment approval button, and click run!
Your output will look like this:
As you can see, you’ve successfully created a complex query that shows you the name of the restaurant, the borough, and the cuisine. You can now commit and deploy this as a custom endpoint in your Neurelo environment and call this API from your applications. Great job!

To sum things up...

This tutorial has successfully taken you through how to create a Neurelo account, connect your MongoDB Atlas database to Neurelo, explore Neurelo’s API Playground, and even create complex queries using their AI Assistant function. Now that you’re familiar with the basics, you can always take things a step further and incorporate the above learnings in a new application.
For help, Neurelo has tons of documentation, getting started videos, and information on their APIs.
To learn more about why developers should use Neurelo, check out the hyper-linked resource, as well as this article produced by our very own Matt Asay.

Facebook Icontwitter iconlinkedin icon
Rate this tutorial
star-empty
star-empty
star-empty
star-empty
star-empty
Related
Tutorial

Working with MongoDB Transactions with C# and the .NET Framework


Sep 23, 2022 | 3 min read
Tutorial

Building a Crypto News Website in C# Using the Microsoft Azure App Service and MongoDB Atlas


Jun 13, 2023 | 9 min read
Tutorial

Integrate Azure Key Vault with MongoDB Client-Side Field Level Encryption


May 24, 2022 | 9 min read
Tutorial

Type Safety with Prisma & MongoDB


May 19, 2022 | 4 min read
Table of Contents