How to use monk - 10 common examples

To help you get started, we’ve selected a few monk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathieudutour / kayero / src / js / actions.js View on Github external
.reduce((prev, k) => {
      if (!data[k].__secure) {
        prev[k] = monk(data[k].url)
        return prev
      }
      let uri = data[k].url.split('mongodb-secure://')[1]

      if (uri.indexOf('.') === 0) { // handle relative path
        if (filePath) {
          const directory = path.dirname(filePath)
          uri = path.join(directory, uri)
        }
      }

      const secret = JSON.parse(fs.readFileSync(uri, 'utf8'))
      if (Array.isArray(secret)) {
        prev[k] = monk(...secret)
      } else {
        prev[k] = monk(secret)
github mathieudutour / kayero / src / js / actions.js View on Github external
if (!data[k].__secure) {
        prev[k] = monk(data[k].url)
        return prev
      }
      let uri = data[k].url.split('mongodb-secure://')[1]

      if (uri.indexOf('.') === 0) { // handle relative path
        if (filePath) {
          const directory = path.dirname(filePath)
          uri = path.join(directory, uri)
        }
      }

      const secret = JSON.parse(fs.readFileSync(uri, 'utf8'))
      if (Array.isArray(secret)) {
        prev[k] = monk(...secret)
      } else {
        prev[k] = monk(secret)
      }
      return prev
    }, {})
  return dbs
github mathieudutour / kayero / src / js / actions.js View on Github external
return prev
      }
      let uri = data[k].url.split('mongodb-secure://')[1]

      if (uri.indexOf('.') === 0) { // handle relative path
        if (filePath) {
          const directory = path.dirname(filePath)
          uri = path.join(directory, uri)
        }
      }

      const secret = JSON.parse(fs.readFileSync(uri, 'utf8'))
      if (Array.isArray(secret)) {
        prev[k] = monk(...secret)
      } else {
        prev[k] = monk(secret)
      }
      return prev
    }, {})
  return dbs
github vadimdemedes / mongorito / build / mongorito.js View on Github external
Mongorito.connect = function connect() {
    for (var _len = arguments.length, urls = Array(_len), _key = 0; _key < _len; _key++) {
      urls[_key] = arguments[_key];
    }

    // convert mongo:// urls to monk-supported ones
    urls = urls.map(function (url) {
      return url.replace(/^mongo\:\/\//, "");
    });

    var db = monk.apply(null, urls);

    // if there is already a connection
    // don't overwrite it with a new one
    if (!this.db) this.db = db;

    return db;
  };
github desmosinc / desmos-sample-cms / routes / lessons.js View on Github external
router.get('/api/:id', function(req, res) {
  var db = req.db;
  var collection = db.get('lessons');
  var objID = monk.id(req.params.id);
  collection.findOne({_id: objID})
    .then(function(doc) {
      res.send(doc);
    })
    .catch(function(err) {
      res.send(err);
    });
});
github DemocracyOS / notifier / lib / jobs / lib / comment-reply.js View on Github external
agenda.define(jobName, (job, done) => {
    const { topic, comment, reply, url } = job.attrs.data

    comments.distinct('replies.author', {
      _id: monk.id(comment.id)
    }).then((usersToNotify) => {
      usersToNotify.push(monk.id(comment.author.id))

      return users.find({
        $and: [
          {
            _id: { $in: usersToNotify },
            'notifications.replies': true
          },
          { _id: { $ne: monk.id(reply.author.id) } }
        ]
      }).each((user, { pause, resume }) => {
        pause()

        agenda.now(jobNameForSingleUser, {
          topicTitle: topic.mediaTitle,

monk

The wise MongoDB API

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis