What is MongoDB URL in Webuzo?

In the rapidly evolving landscape of web development, MongoDB stands out as a leading NoSQL database, essential for building dynamic, scalable web applications within the MERN stack (MongoDB, Express.js, React, Node.js). Alongside, Webuzo, a user-friendly control panel, simplifies the deployment and management of web servers and applications, including the MERN stack.

This article introduces MongoDB and Webuzo, focusing on a key aspect for MERN Stack hosting providers and developers: locating the MongoDB URL. Understanding how to find and use this URL through Webuzo is crucial for seamless application development and deployment. Whether you’re setting up a project or providing support, this guide aims to streamline your workflow with MongoDB and Webuzo.

Well, we didn’t find any documentation regarding this from Webuzo or MongoDB officials. So, we asked Webuzo support for this and they gave us a solution. Here I’m sharing that with you people.

So, we created a database from the Webuzo control panel but at the time of authorization, it’s showing an authorization error. So, we sent that error code to the Webuzo team and told them which MongoDB URL could fix the error. I mention here that the error

const express = require('express');
const app = express();
const port = 5000;
const BookRouters = require('./routes/books');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const cors = require('cors');
const Book = require('./models/Books');

app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(cors());

main().catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://mognodb_user:[email protected].1:27017/mongodb_name')
.then(()=>{
console.log("Database connected");
})
.catch((e)=>{
console.log("Error counter", e);
})
const bookList = await Book.find({});
console.log(bookList)
app.listen(port, () => {
console.log(`App opening to: http://127.0.0.1:${port}`);
})
// use `await mongoose.connect('mongodb://user:[email protected]:27017/test');` if your database has auth enabled
}
app.get('/', (req, res, next) => {
res.send("Server is running...");
});

app.use('/books', BookRouters);

Then they replied to us with a MongoDB structure which we can use for MongoDB Compass and others there we need to add MongoDB URL.

Here is the MongoDB URL structure:

mongodb://satisfymongo_user:[email protected]:27017/satisfymongo_db?authSource=admin

mognodb-url-in-webuzo-structure-explain

In the above URI, we have added  ?authSource=admin because users are created in the admin database.
If authSource is unspecified, authSource defaults to the defaultauthdb(‘satisfymongo_db’) specified in the connection string.