Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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();
});
});
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) {
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);
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
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
function Database () {
this.db = mongo.db (config.database);
// Main collections
this.users = new Collection (this, 'users');
}
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);
})
}
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});
"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');