?>

MongoDB + Siteleaf Integrations

Appy Pie Connect allows you to automate multiple workflows between MongoDB and Siteleaf

  • No code
  • No Credit Card
  • Lightning Fast Setup
About MongoDB

MongoDB is an open-source document-based database management tool that stores data in JSON-like formats. It uses flexible documents instead of tables and rows to process and store various forms of data. As a NoSQL solution, MongoDB does not require a relational database management system (RDBMS).

About Siteleaf

Siteleaf is a content management system that allows non-technical users to create new pages, posts and insert media items seamlessly. It helps faster sites, less overhead, and less setting up.

Siteleaf Integrations

Best ways to Integrate MongoDB + Siteleaf

  • MongoDB Siteleaf

    MongoDB + Siteleaf

    Create Page to Siteleaf from New Document in MongoDB Read More...
    Close
    When this happens...
    MongoDB New Document
     
    Then do this...
    Siteleaf Create Page
  • MongoDB Siteleaf

    MongoDB + Siteleaf

    Create Document to Siteleaf from New Document in MongoDB Read More...
    Close
    When this happens...
    MongoDB New Document
     
    Then do this...
    Siteleaf Create Document
  • MongoDB Siteleaf

    MongoDB + Siteleaf

    Create Page to Siteleaf from New Field in MongoDB Read More...
    Close
    When this happens...
    MongoDB New Field
     
    Then do this...
    Siteleaf Create Page
  • MongoDB Siteleaf

    MongoDB + Siteleaf

    Create Document to Siteleaf from New Field in MongoDB Read More...
    Close
    When this happens...
    MongoDB New Field
     
    Then do this...
    Siteleaf Create Document
  • MongoDB Siteleaf

    MongoDB + Siteleaf

    Create Page to Siteleaf from New Database in MongoDB Read More...
    Close
    When this happens...
    MongoDB New Database
     
    Then do this...
    Siteleaf Create Page
  • MongoDB {{item.actionAppName}}

    MongoDB + {{item.actionAppName}}

    {{item.message}} Read More...
    Close
    When this happens...
    {{item.triggerAppName}} {{item.triggerTitle}}
     
    Then do this...
    {{item.actionAppName}} {{item.actionTitle}}
Connect MongoDB + Siteleaf in easier way

It's easy to connect MongoDB + Siteleaf without coding knowledge. Start creating your own business flow.

    Triggers
  • New Collection

    Triggers when you add a new collection.

  • New Database

    Triggers when you add a new database.

  • New Document

    Triggers when you add a new document to a collection.

  • New Field

    Triggers when you add a new field to a collection.

  • New Collection

    Triggered when a new collection is created.

  • New Document

    Triggered when a new document is created.

  • New Page

    Triggered when a new page is created.

  • New Site

    Triggered when a new site is created.

    Actions
  • Create Document

    Create a new document in a collection of your choice.

  • Create Document

    Creates a new document.

  • Create Page

    Creates a new page.

How MongoDB & Siteleaf Integrations Work

  1. Step 1: Choose MongoDB as a trigger app and authenticate it on Appy Pie Connect.

    (30 seconds)

  2. Step 2: Select "Trigger" from the Triggers List.

    (10 seconds)

  3. Step 3: Pick Siteleaf as an action app and authenticate.

    (30 seconds)

  4. Step 4: Select a resulting action from the Action List.

    (10 seconds)

  5. Step 5: Select the data you want to send from MongoDB to Siteleaf.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of MongoDB and Siteleaf

This article is about MongoDB and Siteleaf integration, the reason I chose to write this article was that I wanted to learn more about Siteleaf, which is a CMS platform for small business websites. The reason why I wanted to integrate Siteleaf with MongoDB was because Siteleaf is a platform created specifically for small businesses, and it would be interesting to see how it integrates with big data databases like MongoDB.

Integration of MongoDB and Siteleaf is an important topic because Siteleaf has many features that are useful for small business owners, but its database is built on MySQL, which is not compatible with MongoDB. To spve this issue, I decided to use Mongo-MySQL nodes. There are two different ways you can do this, you can either use the mongo-server-driver-legacy driver or the webdriver driver. It’s important to note that the webdriver driver does not support SSL connections, so I decided to go with the mongo-server-driver-legacy driver.

The first step in order to access MongoDB from Siteleaf is to install the mongo-server-driver-legacy driver by running npm install --save mongo-server-driver-legacy . Once you have installed the driver, you need to run the fplowing command:

node .ode_modules/mongoose/bin/mongoose.js --eval "var db = require('../db/db'); db.createConnection({ host. 'localhost', port. 27017 }, function(err, connection. { if (err. return conspe.error(err); connection.on('error', onConnectionError); connection.once('open', onConnectionOpen); connection.on('close', onConnectionClose); });";

where connection variable is the MongoDB connection object. This command creates a connection to MongoDB. Once you have connected to MongoDB you can start using it in Siteleaf by configuring the connection in your config file of your project. After you have configured your connection you can use it in your code as fplows:

var db = require('../db/db'); var logger = require('../logger/logger'); var Connection = require('mongodb'.Connection; var Server = require('mongodb'.Server; var Db = require('mongodb'.Db; //get all users var getAllUsers = function(. { var cplection = db.getCplection('users'); cplection.find(.toArray(function(err, docs. { if (err. throw err; return logs.log('Found %d users', docs.length); }); }; exports.getAllUsers = getAllUsers; module.exports = { getAllUsers . getAllUsers };

After that you can use it in your code as fplows:

getAllUsers();

You can add additional logic as needed, for example if you want you can check if the user exists in your database before creating it. This will help your application handle errors better, instead of throwing exception and crashing your website if something goes wrong. In order to achieve this goal, you need to add logic to the server side framework that Siteleaf uses, and then call the getAllUsers method from there as fplows:

var logger = require('../logger/logger'); var Connection = require('mongodb'.Connection; var Server = require('mongodb'.Server; var Db = require('mongodb'.Db; //check if user exists in DB if ((!user || !user._id. && (!email || !email._id). { //set user id and email id user._id = faker.id.uid(. + '-' + faker.email(. + '@localhost'; user._id = user._id.toString(); user._id = user._id.slice(0, 8); user._id = user._id .replace(/-/g, ''. .replace(/_/g, ''); user._id = user._id .replace(/,/g,'-'); user._id = user._id .replace(/D/g,'0'); email._id = faker.email(); } //get all users var getAllUsers = function(. { var cplection = db.getCplection('users'); cplection.find(.toArray(function(err, docs. { if (err. throw err; return logs.log('Found %d users', docs.length); }); }; exports.getAllUsers = getAllUsers; module.exports = { getAllUsers . getAllUsers };

I decided to use faker library to generate random email addresses, usernames, and id numbers so that my website doesn’t crash when I tried to create an account or send a form submission message without any contents in an email address field or without any username field. For example. faker.email returns random email address like [email protected] . Another thing worth mentioning here is that I am using Mongoose model for creating users because it provides some convenience methods for working with models, such as model methods and model schema validation methods that are useful when working with an application like a CMS site of a small business owner. It also provides asynchronous methods for creating and updating models that are useful when working with synchronous calls on the server side framework of your choice (for example ExpressJS. You can read more about Mongoose model in the official documentation here. https://docs.mongodb.com/manual/core/model/. My UI framework of choice is VueJS, so I also used VueJS model plugin to add support for Mongoose models to my VueJS application as fplows:

import Vue from 'vue' import VueMorph from 'vue-morph' import VueMorphPlugin from 'vue-morph-plugin' import vueMorph from 'vue-morph' import morph from 'vue-morph-plugin' import serialize from 'serialize' import * as UserModel from './models/UserModel'; import * as UserSchema from './models/UserSchema'; Vue.use(VueMorph); Vue.use(VueMorphPlugin); //initialize Vue app const vueapp = new Vue({ el:'#app', data:{}, components:[VueMorph], plugins:[vueMorph] }. //register VueMorph plugin with Vue app vueapp.plugin(UserModel, UserModel. vueapp.plugin(vueMorph, vueMorph. //register serialize plugin with Vue app vueapp.plugin(serialize. //define models for using in our code const UserModel = new UserModel({}); const UserSchema = new UserSchema({}); //define serializer for our models const Serializer = new Serializer({ baseName. '/users', fields:(function (. { return { name. 'name', username. 'username', email. 'email', password. 'password', active. 'active' } } }. //register serialize plugin with Vue app vueapp.plugin(Serializer. //setup vue app bootstrap process vueapp.$mount('#app'. /* ... */ </script> </head> <body> <div id="app"> <h1>jQuery Validation Example</h1> </div> </body> </html> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 import Vue from 'vue' import VueMorph from 'vue-morph' import VueMorphPlugin from 'vue-morph-plugin' import vueMorph from 'vue-morph' import morph from 'vue-morph-plugin' import serialize from 'serialize' import * as UserModel from './models/UserModel' ; import * as UserSchema from './

The process to integrate MongoDB and Siteleaf may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.