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

Build Your First .NET Core Application with MongoDB Atlas

So you’re a .NET Core developer or you’re trying to become one and you’d like to get a database included into the mix. MongoDB is a great choice and is quite easy to get started with for your .NET Core projects.

In this tutorial, we’re going to explore simple CRUD operations in a .NET Core application, something that will make you feel comfortable in no time!

Read More

Implement Full-Text Search over a GraphQL API in MongoDB Atlas

GraphQL can be an extremely powerful and efficient way to create APIs and MongoDB Realm makes it easy by allowing you to connect your collections to GraphQL schemas without writing a single line of code. I wrote about some of the basics behind configuring MongoDB and Realm for GraphQL in an announcement tutorial a while back.

As you find yourself needing to do more advanced things with GraphQL, you’re going to need to familiarize yourself with custom resolvers. If you can’t map collection fields to a schema from within Realm and you need to write custom logic using a serverless function instead, this is where the custom resolvers come into play. Take the example of needing to use an aggregation pipeline within MongoDB. The complex logic that you add to your aggregation pipeline isn’t something you can map. The good news is that you don’t need to abandon MongoDB Realm for these scenarios, but you can leverage Realm’s custom resolvers instead.

In this tutorial we’re going to see how to create a custom resolver that implements Atlas Search for our GraphQL API using Realm Functions, enabling you to add fast, relevant full-text search to your applications.

Read More

Building a Space Shooter Game that Syncs with Unity and MongoDB Realm

When developing a game, in most circumstances you’re going to need to store some kind of data. It could be the score, it could be player inventory, it could be where they are located on a map. The possibilities are endless and it’s more heavily dependent on the type of game.

Need to sync that data between devices and your remote infrastructure? That is a whole different scenario.

If you managed to catch MongoDB .Live 2021, you’ll be familiar that the first stable release of the MongoDB Realm SDK for Unity was made available. This means that you can use Realm in your Unity game to store and sync data with only a few lines of code.

In this tutorial, we’re going to build a nifty game that explores some storage and syncing use-cases.

Read More

Get Hyped: Synonyms in MongoDB Atlas Search

Sometimes, the word you’re looking for is on the tip of your tongue, but you can’t quite grasp it. For example, when you’re trying to find a really funny tweet you saw last night to show your friends. If you’re sitting there reading this and thinking, “Wow, Anaiya and Nic, you’re so right. I wish there was a fix for this,” strap on in! We have just the solution for those days when your precise linguistic abilities fail you, but you have an idea of what you’re looking for: Synonyms in Atlas Search.

In this tutorial, we are going to be showing you how to index a MongoDB collection to capture searches for words that mean similar things. For the specifics, we’re going to search through content written with Generation Z (Gen-Z) slang. The slang will be mapped to common words with synonyms and as a result, you’ll get a quick Gen-Z lesson without having to ever open TikTok.

If you’re in the mood to learn a few new words, alongside how effortlessly synonym mappings can be integrated into Atlas Search, this is the tutorial for you.

Read More

Influence Search Result Ranking with Function Scores in Atlas Search

When it comes to natural language searching, it’s useful to know how the order of the results for a query were determined. Exact matches might be obvious, but what about situations where not all the results were exact matches due to a fuzzy parameter, the $near operator, or something else?

This is where the document score becomes relevant.

Every document returned by a $search query in MongoDB Atlas Search is assigned a score based on relevance, and the documents included in a result set are returned in order from highest score to lowest.

You can choose to rely on the scoring that Atlas Search determines based on the query operators, or you can customize its behavior using function scoring and optimize it towards your needs. In this tutorial, we’re going to see how the function option in Atlas Search can be used to rank results in an example.

Read More

An Introduction to Indexes for MongoDB Atlas Search

Imagine reading a long book like “A Song of Fire and Ice,” “The Lord of the Rings,” or “Harry Potter.” Now imagine that there was a specific detail in one of those books that you needed to revisit. You wouldn’t want to search every page in those long books to find what you were looking for. Instead, you’d want to use some sort of book index to help you quickly locate what you were looking for. This same concept of indexing content within a book can be carried to MongoDB Atlas Search with search indexes.

Atlas Search makes it easy to build fast, relevant, full-text search on top of your data in the cloud. It’s fully integrated, fully managed, and available with every MongoDB Atlas cluster running MongoDB version 4.2 or higher.

Correctly defining your indexes is important because they are responsible for making sure that you’re receiving relevant results when using Atlas Search. There is no one-size-fits-all solution and different indexes will bring you different benefits.

In this tutorial, we’re going to get a gentle introduction to creating indexes that will be valuable for various full-text search use cases.

Read More

Searching on Your Location with Atlas Search and Geospatial Operators

When thinking about full-text search, text and other string data is probably the first thing to come to mind. In fact, if you’ve been keeping up with my tutorials, you might remember Building an Autocomplete Form Element with Atlas Search and JavaScript or Visually Showing Atlas Search Highlights with JavaScript and HTML, both of which were on text search examples in MongoDB Atlas Search.

Being able to use natural language search on text data is probably one of the most popular use-cases, but there are scenarios where you might need to narrow the results even further.

Let’s say you’re building a restaurant review application like Yelp or a bed and breakfast booking system like Airbnb. Sure, you’ll enter some kind of text criteria for what you’re looking for, but there’s also a location aspect to it. For example, if you want to find a place to get a cheeseburger within walking distance of your current location, you probably don’t want your search results to contain entries from another country. This is an example of a geo search, where you would want to return results based on location coordinates.

In this tutorial, we’re going to see how to use Atlas Search and the compound operator to search based on text entered and within a certain geographical area. For the text entered, we’ll use the autocomplete operator, and for the geospatial component, we’ll use the geoWithin operator.

Read More