MongoDB
This feature is currently in beta and is subject to change. If you are interested in testing it out, please reach out to us via Discord or email out support.
MongoDB instrument to measure the performance of queries directly in the CI.
Getting Started
Prerequisites
- MongoDB instrument enabled in your CodSpeed account (reach out to us to enable)
- MongoDB instance running in your CI environment or the cloud
How to set up a MongoDB instance in your CI environment?
we recommend using the
art049/mongodb-cluster-action
to run MongoDB in your CI environmentdynamic setup of a MongoDB instance during the setup phase of the benchmarks is supported, using tools such as
testcontainers
orvitest-mongodb
Activate the mongodb
instrument in the CodSpeed Action
To activate the MongoDB instrument during the run of your benchmarks in the CodSpeed Action, make the following changes to your workflow file:
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
run: <your-benchmark-command>
with:
# Activate the MongoDB instrument
instruments: mongodb
# (Optional) Specify the name of the environment variable that contains the MongoDB
# connection string and is used by your application to connect to MongoDB.
# If not specified, you will have to provide the connection string dynamically during
# the setup phase of your benchmarks.
mongo-uri-env-name: MONGO_URL
If using the mongo-uri-env-name
option, make sure to set the actual value of the environment variable in the env
section of your workflow file.
Otherwise, the MongoDB instrument will not be able to connect to your MongoDB instance.
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
run: <your-benchmark-command>
with:
instruments: mongodb
mongo-uri-env-name: MONGO_URL
env:
MONGO_URL: mongodb://localhost:27017
If the value of connection string cannot be set in the workflow file, you can omit the mongo-uri-env-name
option and provide the connection string dynamically during the setup phase of your benchmarks.
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
run: <your-benchmark-command>
with:
instruments: mongodb
Language specific examples
If you are using the mongo-uri-env-name
option, the integration should work out of the box at this stage 🎉
However, if you are not using the mongo-uri-env-name
option, you will have to provide the connection string dynamically during the setup phase of your benchmarks.
Select your language below to see how to do that.
To view examples and how to dynamically provide the connection string during the setup phase of your benchmarks, select your language below:
🗃️ NodeJS
2 items
- Python: Not supported yet (coming soon)
- Rust: Not supported yet (coming soon)