Mongo Express is a web-based MongoDB admin interface written with Node.js, Express and Bootstrap3. With Mongo Express Docker Extension, now you can setup Mongo Express along with MongoDB with few clicks.
This is Work-in-progress
- Building Compose File
- Constructing UI
- Final Testing
git clone https://github.com/collabnix/mongoexpress-docker-extension
make build-extension
docker extension install ajeetraina/mongodb-express-docker-extension:1.0
Accessing Mongo Express using Extensions Dashboard
To connect to a MongoDB instance running on a remote host on port 27017 with authentication in place, you can directly open the container terminal via Docker Dashboard:
mongosh "mongodb://localhost:27017" --username root -p
Add "example" as the password.
On a fresh connection, the MongoDB shell will automatically connect to the test database by default. You can safely use this database to experiment with MongoDB and the MongoDB shell.
Alternatively, you could also switch to another database to run all of the example commands given in this tutorial. To switch to another database, run the use command followed by the name of your database:
test> use collabnix
switched to db collabnix
collabnix>
Let's assume that we have the following document in the form of JSON:
{
"name": "Docker Developer Meetup",
"city": "Bangalore",
"country": "India",
"gps": {
"lat": 12.9716,
"lng": 77.5946
}
}
Insert this document into a new collection called collabnix using the insertOne method. As its name implies, insertOne is used to create individual documents, as opposed to creating multiple documents at once.
In the MongoDB shell, run the following operation:
db.meetup.insertOne(
{
"name": "Docker Developer Meetup",
"city": "Bangalore",
"country": "India",
"gps": {
"lat": 12.9716,
"lng": 77.5946
}
}
)
collabnix> db.meetup.insertOne(
{
"name": "Docker Developer Meetup",
"city": "Bangalore",
"country": "India",
"gps": {
"lat": 12.9716,
"lng": 77.5946
}
}
)
{
acknowledged: true,
insertedId: ObjectId("637875b9a440589326e2c8a4")
}
collabnix>
The operation’s output will inform you that it executed successfully, and also provides the ObjectId which it generated automatically for the new document.
collabnix> db.meetup.countDocuments()
1
collabnix>
1