Skip to content

MongoDB

MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.

You can easily add it to your Lando app by adding an entry to the services top-level config in your Landofile.

yaml
services:
  myservice:
    type: mongo

Supported versions

Legacy versions

You can still run these versions with Lando but for all intents and purposes they should be considered deprecated (e.g. YMMV and do not expect a ton of support if you have an issue).

Patch versions

Not officially supported!

While we allow users to specify patch versions for this service they are not officially supported so if you use one, YMMV.

To use a patch version, you can do something as shown below:

yaml
services:
  myservice:
    type: mongo:4.1.4

Custom Installation

This plugin is included with Lando by default. That means if you have Lando version 3.0.8 or higher then this plugin is already installed!

However if you would like to manually install the plugin, update it to the bleeding edge or install a particular version then use the below. Note that this installation method requires Lando 3.5.0+.

::: code-group-item LANDO 3.21+

bash
lando plugin-add @lando/mongo

::: ::: code-group-item HYPERDRIVE

bash
# @TODO
# @NOTE: This doesn't actaully work yet
hyperdrive install @lando/mongo

::: ::: code-group-item DOCKER

bash
# Ensure you have a global plugins directory
mkdir -p ~/.lando/plugins

# Install plugin
# NOTE: Modify the "npm install @lando/mongo" line to install a particular version eg
# npm install @lando/mongo@0.5.2
docker run --rm -it -v ${HOME}/.lando/plugins:/plugins -w /tmp node:18-alpine sh -c \
  "npm init -y \
  && npm install @lando/mongo --production --flat --no-default-rc --no-lockfile --link-duplicates \
  && npm install --production --cwd /tmp/node_modules/@lando/mongo \
  && mkdir -p /plugins/@lando \
  && mv --force /tmp/node_modules/@lando/mongo /plugins/@lando/mongo"

# Rebuild the plugin cache
lando --clear

:::

You should be able to verify the plugin is installed by running lando config --path plugins and checking for @lando/mongo. This command will also show you where the plugin is being loaded from.