lc mongo
Connect to your LocalCloud MongoDB database using the interactive MongoDB shell.Usage
Commands
lc mongo connect
Connect to MongoDB using mongosh (or legacy mongo client).
- Opens an interactive MongoDB shell session
- Connects to the LocalCloud MongoDB instance
- Uses connection string:
mongodb://localcloud:localcloud@localhost:27017/localcloud?authSource=admin
- Tries
mongosh
first, falls back to legacymongo
client
Prerequisites
MongoDB Service Running
MongoDB Client Tools
You need MongoDB client tools installed: macOS:Example Usage
Connect to MongoDB
Basic MongoDB Operations
Once connected, you can use standard MongoDB commands:Connection Details
- Host:
localhost
- Port:
27017
- Username:
localcloud
- Password:
localcloud
- Database:
localcloud
- Auth Database:
admin
Troubleshooting
MongoDB Service Not Running
Client Not Found
- Install mongosh:
brew install mongodb/brew/mongodb-community-shell
- Install legacy mongo client
- Use Docker:
lc exec mongodb mongosh
Connection Refused
- Check service status:
lc status
- Check logs:
lc logs mongodb
- Restart service:
lc restart mongodb
Authentication Failed
- Verify credentials are default:
localcloud:localcloud
- Check MongoDB auth configuration in
localcloud.yaml
- Try connecting via Docker:
lc exec mongodb mongosh
Direct Docker Access
If the client tools aren’t installed, you can connect directly via Docker:Related Commands
lc start mongodb
- Start MongoDB servicelc status
- Check MongoDB statuslc logs mongodb
- View MongoDB logslc stop mongodb
- Stop MongoDB service