/nx-oasis

Primary LanguageTypeScript

Oasis

WebSockets Docs

Tools Docs:


### MongoDB
  1. Pull the MongoDB image from the Docker registry:

docker pull mongo

  1. Run a new container using the MongoDB image with bound port 27017:

docker run --name some-mongo -p 27017:27017 -d mongo

  1. Connect to the MongoDB instance running in the container:

docker exec -it some-mongo mongo

  1. To persist the data, you can mount a host directory as a data volume for the container:

docker run --name some-mongo -v /my/own/datadir:/data/db -d mongo

  1. To specify the MongoDB configuration options by creating a custom mongod.conf file and mounting it as a configuration volume for the container:

docker run --name some-mongo -v /my/own/mongod.conf:/etc/mongod.conf -d mongo --config /etc/mongod.conf

  1. An example of a basic mongod.conf file that can be used to configure a MongoDB instance:
# mongod.conf

# MongoDB configuration file

# Where and how to store data.
storage:
  dbPath: /data/db
  journal:
    enabled: true

# Where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0

# Process management options
processManagement:
  fork: true
  pidFilePath: /var/run/mongodb/mongod.pid

# Replication options
replication:
  replSetName: rs0

Ref