Integrate with MongoDB?

Hi, I’m seeking to use Bubble to build a web application that will provide logic to a mobile application. The mobile application will utilise MongoDB as its backend.

My question is: is it technically feasible to use MongoDB as the backend database for Bubble?

Yes it is “technically feasible” is the short answer. The long answer is, well… longer.

1 Like

any luck researching this yet?

I’m not sure who your question is directed to but this is possible using a plugin. Here is an example of a plugin SSA code that will do it. I’m making an assumption that if you are asking about mongoDB you are a developer and can figure out the rest of the process:

function(properties, context) { const { MongoClient } = require("mongodb");

// Replace the uri string with your MongoDB deployment's connection string.
const uri = "mongodb+srv://";


let client = context.async(async callback => {
    try {
        const data = await new MongoClient(uri).connect(); 
        callback(null, data);
    }
    catch (error) {
        callback(error);
    }
});    

let data = context.async(async callback => {
    try {
      	const database = client.db("sample_guides");
            const planets = database.collection("planets");
			
            var data = await planets.find({}).toArray();
        	callback(null, data);
    }
    catch (error) {
        callback(error);
    }
});  

var output = JSON.stringify(data);

return { output } }
2 Likes

It seems that it is possible without needing any special plugin or integration.

MongoDB have another product called “Realm” which allows you to build REST API, that integrates directly with the Data API of MongoDB Atlas. It’s under the “app services” section, in your account.

nb: You need knowledge of Node.js to build the API.

1 Like