MongoDB instrument for NodeJS
mongodb
instrument
in your CodSpeed GitHub workflow.Minimum integration versions
setupInstruments
function that can be used to
dynamically setup the instruments. This function takes the actual connection
string as an argument and returns the patched connection string that should be
used to connect to the database.
testcontainers
library to
start a MongoDB container and get the connection string. Then, the
setupInstruments
function is used to patch the connection string and set it as
the MONGO_URL
environment variable. Finally, the bench
is run as usual.
setupInstruments
function should be called only once during the whole
benchmark run, and before any connection to the database is established.
Otherwise, the CodSpeed MongoDB instrument will not be able to collect the
metrics.