MongoDB Atlas Search Integration with BuildShip
Pavel Duchovny4 min read • Published Oct 15, 2024 • Updated Oct 15, 2024
SNIPPET
Rate this quickstart
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.
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.
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.
Before you can start using the MongoDB Search Nodes in BuildShip, ensure you have the following prerequisites:
You'll need access to a MongoDB Atlas project. Follow these steps to prepare your account and initiate your first project:
- Navigate to MongoDB Atlas to either sign up for a new account or log in if you are an existing user.
- 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.
- In Atlas, go to the Clusters page for your project.
- Navigate to the Atlas Search page for your cluster.
- Select Atlas Search Visual Editor under Atlas Search Configuration Method and click Next.
- 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.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.
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.
- Generate Embeddings with OpenAI: Use the BuildShip OpenAI Generate Embeddings Node to create embeddings for each document's content.
- Retrieve Collection Documents: Use the Query Collection node to retrieve the necessary documents.
- Update Embedding Column: Update each document with the new embedding values using the Generate Embeddings node and MongoDB Update Document node.
This step is necessary for enabling semantic and hybrid searches in MongoDB.
- Go to your Atlas project's Clusters page.
- Navigate to the Atlas Search page.
- Select JSON Editor under Atlas Vector Search Method and click Next.
- 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
).
- 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.
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.
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.
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.