Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
This adds a new Testcontainer class for MongoDB's Atlas Local container to the existing databases/mongodb module.
The benefits of having this as a Testcontainer (rather than an example for a GenericContainer):
solves the startup time issue using a custom wait strategy based on the runner healthcheck command (see below)
provides the connection string for MongoDB
I've tried to follow all the conventions and style for contributions. I've added unit tests and documentation.
* I might have been a bit verbose in my documentation contribution - happy to trim that down / cut it down
Background
MongoDB Atlas Local combines the MongoDB database engine with MongoT, a sidecar process for advanced searching capabilities built by MongoDB and powered by Apache Lucene.
It allows you to use the following features:
MongoDB Atlas Search: Atlas Search gives MongoDB queries access to the incredible search toolbox that is Lucene. The main use-case is advanced lexical text querying capabilities similar to those found in many search engines. In addition, Atlas Search supports queries with faceting and parallel index search. These can extend MongoDB's aggregation capabilities and performance for uses like statistics and complex filters.
https://www.mongodb.com/docs/atlas/atlas-search/
MongoDB Atlas Vector Search: Supports artificial intelligence (AI) based searches for semantically similar items in your data. Vector indexes store embeddings (high-dimensional vectors encoding semantic meaning) used in large language models (LLMs). This feature makes use of Lucene's vector search capabilities to find the nearness between the values of each vector. This can be a powerful alternative or compliment to lexical text search.
https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/
Pairing these Lucene backed technologies with your MongoDB database allows you to build powerful search capabilities into your applications without the need to manage a separate search engine. You can also extend your search capabilities to include AI based vector searches, which can be useful for recommendation engines, image search, and other applications that require similarity searches.
You cannot start calling Atlas Search commands, such as creating Atlas Search indexes, until the container is ready. The container takes some seconds to attain readiness, whilst:
MongoDB database starts
MongoDB initialises itself as a replica set
MongoT starts and connects to the MongoDB database ready to follow Change Streams for indexing
MongoDB connects to MongoT ready to perform $search and $vectorSearch queries
The MongoDBAtlasLocalContainer uses the container's runner healthcheck command to check for readiness.
This adds a new Testcontainer class for MongoDB's Atlas Local container to the existing databases/mongodb module.
The benefits of having this as a Testcontainer (rather than an example for a GenericContainer):
runner healthcheck
command (see below)I've tried to follow all the conventions and style for contributions. I've added unit tests and documentation. * I might have been a bit verbose in my documentation contribution - happy to trim that down / cut it down
Background
MongoDB Atlas Local combines the MongoDB database engine with MongoT, a sidecar process for advanced searching capabilities built by MongoDB and powered by Apache Lucene.
It allows you to use the following features:
MongoDB Atlas Search: Atlas Search gives MongoDB queries access to the incredible search toolbox that is Lucene. The main use-case is advanced lexical text querying capabilities similar to those found in many search engines. In addition, Atlas Search supports queries with faceting and parallel index search. These can extend MongoDB's aggregation capabilities and performance for uses like statistics and complex filters. https://www.mongodb.com/docs/atlas/atlas-search/ MongoDB Atlas Vector Search: Supports artificial intelligence (AI) based searches for semantically similar items in your data. Vector indexes store embeddings (high-dimensional vectors encoding semantic meaning) used in large language models (LLMs). This feature makes use of Lucene's vector search capabilities to find the nearness between the values of each vector. This can be a powerful alternative or compliment to lexical text search. https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/ Pairing these Lucene backed technologies with your MongoDB database allows you to build powerful search capabilities into your applications without the need to manage a separate search engine. You can also extend your search capabilities to include AI based vector searches, which can be useful for recommendation engines, image search, and other applications that require similarity searches.
The container (mongodb/mongodb-atlas-local) documentation can be found here: https://www.mongodb.com/docs/atlas/cli/current/atlas-cli-deploy-docker/
Container Healthcheck
You cannot start calling Atlas Search commands, such as creating Atlas Search indexes, until the container is ready. The container takes some seconds to attain readiness, whilst:
The MongoDBAtlasLocalContainer uses the container's
runner healthcheck
command to check for readiness.