xqcore-mongodb

MongoDB module for xqcore

Usage no npm install needed!

<script type="module">
  import xqcoreMongodb from 'https://cdn.skypack.dev/xqcore-mongodb';
</script>

README

XQNode MongoDB module

Usage

    //Set default db connection
    require('xqnode-mongodb').conf = {
        "host": "myhost.tld",
        "port": 17027,
        "dbname": "mydb"
    };

    //Create a MongoDB Model
    var Model = require('xqnode-mongodb').Model;
    var model = new Model({
        collection: 'myCollection'
    });

Methods

fetch() Gets a model from DB and sets data to model sync() To be called everytime the model changes its data Thorws an db.error handler if something wents rong with the database