Explore Developer Center's New Chatbot! MongoDB AI Chatbot can be accessed at the top of your navigation to answer all your MongoDB questions.

Join us at AWS re:Invent 2024! Learn how to use MongoDB for AI use cases.
MongoDB Developer
Atlas
plus
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right
Productschevron-right
Atlaschevron-right

MongoDB Atlas Search Integration with BuildShip

Pavel Duchovny4 min read • Published Oct 15, 2024 • Updated Oct 15, 2024
AIIDESearchJavaScriptAtlas
SNIPPET
Facebook Icontwitter iconlinkedin icon
Rate this quickstart
star-empty
star-empty
star-empty
star-empty
star-empty
The MongoDB Search Integration in BuildShip enables users to leverage MongoDB Atlas Search for their advanced search and indexing needs through a streamlined, low-code interface. MongoDB Atlas Search offers powerful full-text search, vector search, and hybrid search capabilities, making it possible to build highly relevant and sophisticated search experiences within your applications and websites.
MongoDB Atlas Search is a fully integrated, powerful, and easy-to-use search solution that allows developers to build rich search experiences without the need for external search systems. By leveraging the scalability and reliability of MongoDB Atlas, developers can utilize features like full-text search, relevance-based ranking, and sophisticated indexing—all directly within their managed database environment.

Introduction to BuildShip

BuildShip is a low-code/no-code platform that enables users to create sophisticated applications, workflows, and integrations quickly. With its intuitive drag-and-drop interface, BuildShip empowers developers and non-developers alike to design solutions without needing to write extensive code. The MongoDB integration in BuildShip makes it easy to build data-driven applications with advanced search capabilities, leveraging MongoDB Atlas Search.

MongoDB Search Nodes in BuildShip

BuildShip's MongoDB Search Nodes provide an easy connection to MongoDB Atlas instances, allowing developers to create APIs, scheduled jobs, and search-centric workflows seamlessly.
These nodes offer a no-code interface for advanced search features, simplifying tasks such as indexing documents, adjusting settings, and performing complex queries. This makes managing search functionalities efficient and accessible within the intuitive BuildShip environment.

Get Started ✅

Prerequisites ✅

Before you can start using the MongoDB Search Nodes in BuildShip, ensure you have the following prerequisites:

MongoDB Atlas Project

You'll need access to a MongoDB Atlas project. Follow these steps to prepare your account and initiate your first project:
  1. Navigate to MongoDB Atlas to either sign up for a new account or log in if you are an existing user.
  2. Create a new project and configure your database, including adding sample data if needed.
For detailed instructions on setting up your MongoDB Atlas project and integrating it with BuildShip, refer to the [BuildShip X MongoDB](documentation](https://docs.buildship.com/database/mongodb#database).
To use the Full Text Search capabilities, you must configure an Atlas Search index to query data in your Atlas cluster.

Setting Up an Atlas Search Index

Atlas Search Index
  1. In Atlas, go to the Clusters page for your project.
  2. Navigate to the Atlas Search page for your cluster.
  3. Select Atlas Search Visual Editor under Atlas Search Configuration Method and click Next.
  4. Enter the Index Name (e.g., fts), set the Database and Collection, and click Create Search Index.
The index should be created with the name fts if you do not wish to change the Index Name > in the node. You can create this index using the Atlas UI, the Atlas Search API, or the Atlas CLI.

Using the Full Text Search Node

MongoDB Search
Inputs:
  • Connection String: The MongoDB connection string.
  • Database: The name of the database.
  • Collection: The collection name for full-text search.
  • Query: The search query string.
  • Index Name: (Optional) The number of results to return, default is 10.
Output: The Full Text Search node returns an object with the following properties:
1{
2 "success": boolean,
3 "count": integer,
4 "documents": [
5 {
6 "document": object
7 }
8 ]
9}
  • success: A boolean indicating if the search was successful.
  • count: Number of documents returned by the search.
  • documents: Array of documents resulting from the query.

Creating Embeddings

To perform semantic search and hybrid search in MongoDB, you need to create embeddings for your documents. These embeddings represent your data as points in multi-dimensional space, enabling sophisticated searches.

Steps to Create Embeddings:

  1. Generate Embeddings with OpenAI: Use the BuildShip OpenAI Generate Embeddings Node to create embeddings for each document's content.
  2. Retrieve Collection Documents: Use the Query Collection node to retrieve the necessary documents.
  3. Update Embedding Column: Update each document with the new embedding values using the Generate Embeddings node and MongoDB Update Document node.
enter image description here
This step is necessary for enabling semantic and hybrid searches in MongoDB.

Create an Atlas Vector Search Index

Atlas Vector Index
  1. Go to your Atlas project's Clusters page.
  2. Navigate to the Atlas Search page.
  3. Select JSON Editor under Atlas Vector Search Method and click Next.
  4. Enter the Index Name (vector_index) and configure:
1{
2 "fields": [
3 {
4 "type": "vector",
5 "path": "embedding",
6 "numDimensions": 1536,
7 "similarity": "euclidean"
8 }
9 ]
10}
  • type: Field type for vector embeddings.
  • path: Path to the embedding field.
  • numDimensions: Typically 1536 if using OpenAI embeddings.
  • similarity: Specify similarity type (e.g., euclidean, cosine).

Using the Semantic Search Node

MongoDB Semantic Search Node
  • Connection String: The MongoDB connection string.
  • Database: The name of the database.
  • Collection: The name of the column in the specified table where the full-text search will be conducted.
  • Query: The search query string that you want to use for finding matching documents.
  • Index Name: The name of the vector search index.
  • Candidates: (Optional) The number of candidate results to consider. Default is 150.
  • Limit: (Optional) The maximum number of results to return. Default is 10.
Output: Same output structure as the Full Text Search Node, providing a list of matching documents.
Hybrid Search combines the power of semantic search and full-text search. This approach allows comprehensive search results by combining the strengths of both methods.
You will need to create both the Full Text Search Index (fts) and the Vector Search Index (vector_index). Ensure both indexes are configured correctly to avoid changing the Index Names in the nodes. Hybrid Search Node
Inputs:
  • Similar to the other search nodes, with additional configurations for both the vector and full-text indexes.
Output: The output structure matches that of the Full Text and Semantic Search nodes, returning matching documents.

Conclusion

Integrating MongoDB's advanced search features into your BuildShip workflows allows for the creation of highly effective, no-code solutions for handling sophisticated search needs. Whether through Full Text Search, Semantic Search, or Hybrid Search, BuildShip and MongoDB Atlas provide a flexible and efficient platform for building powerful search experiences.
Here is an example of a Movie Recommendation application built with BuildShip and MongoDB Atlas Hybrid Search.
Moview recommendation app
Start building applications with MongoDB Atlas and BuildShip today. If you have any questions or need assistance, please check out the MongoDB community forums.
Top Comments in Forums
There are no comments on this article yet.
Start the Conversation

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

Calling the MongoDB Atlas Administration API: How to Do it from Node, Python, and Ruby


Jun 18, 2024 | 4 min read
Tutorial

AWS Glue Visual ETL for Your Data in MongoDB Atlas


Nov 22, 2024 | 3 min read
Tutorial

Tutorial: Build a Movie Search Engine Using Atlas Full-Text Search in 10 Minutes


Sep 09, 2024 | 10 min read
Tutorial

Getting Started With Deno 2.0 & MongoDB


Oct 22, 2024 | 13 min read
Table of Contents