How to use mongoskin - 10 common examples

To help you get started, we’ve selected a few mongoskin 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 EpistasisLab / pennai / tests / integration / jest / util / db.js View on Github external
export const openDbConnection = () => {
	var db;
	var mongouri;

	mongouri="mongodb://dbmongo:27017/FGLab";

	// Connect to MongoDB
	db = mongoskin.db(mongouri, {native_parser: true});

	// Bind collections
	db.bind("projects");
	db.bind("machines");
	db.bind("experiments");
	db.bind("batches");
	db.bind("users");
	db.bind("datasets");

	// Promisify all methods
	Object.keys(mongoskin).forEach((key) => {
	  var value = mongoskin[key];
	  if (typeof value === "function") {
	    Promise.promisifyAll(value);
	    Promise.promisifyAll(value.prototype);
	  }
github twers / Viff-Service / test / lib / job.js View on Github external
var request = require('request');
var fs = require('fs');
var path = require('path');
var mongoskin = require('mongoskin');
var db = mongoskin.db('mongodb://localhost:27017/viffService?auto_reconnect', {safe: true});
var JobsModule = require('../../lib/jobs');

require('../../lib/app');

describe('Jobs RESTFUL', function () {
  var existingFile;
  var uploadsPath = path.join(__dirname, "../../uploads");
  this.timeout(20000);
  // recode existing files in uploads/configFile.json 
  before(function (done) {
    fs.readdir(uploadsPath, function (err, fileList) {
      existingFile = fileList;
      done();
    });
  });
github twers / Viff-Service / test / helper.js View on Github external
var fs = require('fs');
var path = require('path');
var mongoskin = require('mongoskin');
var db = mongoskin.db('mongodb://localhost:27017/viffService?auto_reconnect', {safe: true});

var existingFile;
var uploadsPath = path.join(__dirname, "../uploads");

// recode existing files in uploads/configFile.json 
before(function (done) {
  fs.readdir(uploadsPath, function (err, fileList) {
    existingFile = fileList;
    done();
  });
});

// remove created test uploaded files and revert db changes
after(function (done) {
  //remove uploaded files
  fs.readdir(uploadsPath, function (err, fileList) {
github EpistasisLab / pennai / db.js View on Github external
var Promise = require("bluebird");
var mongoskin = require("mongoskin");
var db;
if (!process.env.MONGODB_URI) {
  console.log("Error: No MongoDB instance specified");
  process.exit(1);
} else {
  // Connect to MongoDB
  db = mongoskin.db(process.env.MONGODB_URI, {native_parser: true});
}

// Bind collections
db.bind("projects");
db.bind("machines");
db.bind("experiments");

// Promisify all methods
Object.keys(mongoskin).forEach(function(key) {
  var value = mongoskin[key];
  if (typeof value === "function") {
    Promise.promisifyAll(value);
    Promise.promisifyAll(value.prototype);
  }
});
Promise.promisifyAll(mongoskin);
github azat-co / practicalnode / code / ch5 / blog-express / app.js View on Github external
const express = require('express')
const routes = require('./routes')
const http = require('http')
const path = require('path')
const mongoskin = require('mongoskin')
const dbUrl = process.env.MONGOHQ_URL || 'mongodb://@localhost:27017/blog'

const db = mongoskin.db(dbUrl)
const collections = {
  articles: db.collection('articles'),
  users: db.collection('users')
}

// const cookieParser = require('cookie-parser')
// const session = require('express-session')
const logger = require('morgan')
const errorHandler = require('errorhandler')
const bodyParser = require('body-parser')
const methodOverride = require('method-override')

const app = express()
app.locals.appTitle = 'blog-express'

// Expose collections to request handlers
github azat-co / practicalnode / code / ch6 / blog-password / app.js View on Github external
const express = require('express')
const routes = require('./routes')
const http = require('http')
const path = require('path')
const mongoskin = require('mongoskin')
const dbUrl = process.env.MONGOHQ_URL || 'mongodb://@localhost:27017/blog'

const db = mongoskin.db(dbUrl)
const collections = {
  articles: db.collection('articles'),
  users: db.collection('users')
}

const cookieParser = require('cookie-parser')
const session = require('express-session')
const logger = require('morgan')
const errorHandler = require('errorhandler')
const bodyParser = require('body-parser')
const methodOverride = require('method-override')

const app = express()
app.locals.appTitle = 'blog-express'

// Expose collections to request handlers
github yue / node-gui / server / db.js View on Github external
function Database () {
    this.db = mongo.db (config.database);

    // Main collections
    this.users = new Collection (this, 'users');
}
github davidgraeff / scenecontrol / core / storage.js View on Github external
exports.init = function(callback) {
	db = mongo.db('localhost:27017/'+configs.runtimeconfig.databasename, {w: 1});
	db.open(function (err) {
		console.log("Database: "+'localhost:27017/'+configs.runtimeconfig.databasename);
		callback(err, null);
	})
}
github emgeee / mean-stack-SFHTML5 / backend / database.js View on Github external
var mongo = require('mongoskin');
var uri = process.env.NODE_ENV === 'production' ? process.env.MONGOLAB_URI : "mongodb://localhost:27017/sfhtml_demo";

console.log('Connecting to', uri);
module.exports = mongo.db(uri, {native_parser:true});
github baryon / tracer / example / mongodb.js View on Github external
"use strict";
var mongo = require('mongoskin');
var db = mongo.db("127.0.0.1:27017/test?auto_reconnect");

var log_conf = {
		transport : function(data) {
			console.log(data.output);
			var loginfo = db.collection("loginfo");
			loginfo.insert( data, function(err, log) {
				if (err) {
					console.error(err);
				}
			});
		}
}

var logger = require('tracer').console(log_conf);

logger.log('hello');

mongoskin

The future layer above node-mongodb-native

MIT
Latest version published 9 years ago

Package Health Score

54 / 100
Full package analysis

Popular mongoskin functions