Better Programming

Advice for programmers.

Follow publication

Member-only story

Learn Advanced Full-Text Searches With MongoDB Atlas Search

Lynn G. Kwong
Better Programming
Published in
8 min readApr 8, 2022
Photo by Daniel Lerman in Unsplash.

As we have learned in a previous post, we can run full-text search queries with MongoDB Atlas Search now. If you are implementing a search engine and haven’t decided which tool to use, MongoDB Atlas Search can be a good alternative to traditional tools like Elasticsearch. In this post, we will introduce some advanced settings and search queries for MongoDB Atlas Search. You will find that they are pretty similar to their counterparts in Elasticsearch. This is because, under the hood, Apache Lucene is used as the core for both Elasticsearch and MongoDB.

It should be noted that MongoDB Atlas Search is only available if your MongoDB databases are hosted by MongoDB Atlas. It’s not available if you manage your MongoDB servers locally.

We will continue to use the laptops collection in the products database we’ve been working on because the product names and attributes are good examples for demonstrating full-text searches.

And if you want to follow along, please download the JSON file and use the following command to import the data to MongoDB Atlas.

Note that you need to change the username, password, and cluster name for your own case. If you have network connection issues, remember to check if your IP address is added to the IP Access List in Atlas UI.

When the above command is run, you will have the products database and laptops collection created automatically in MongoDB Atlas, which contains 200 laptop documents as follows:

Let’s now create an Atlas Search Index that will be used for full-text searches. You can create an Atlas Search Index with the Atlas UI, Atlas…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Lynn G. Kwong
Lynn G. Kwong

Written by Lynn G. Kwong

I’m a Software Developer (https://youtube.com/@kwonglynn) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.

Write a response