database and ajax test added

This commit is contained in:
2019-02-01 14:06:44 +01:00
parent b5eb4c2b79
commit f3c33a35cd
562 changed files with 154325 additions and 16 deletions
View File
View File
+28
View File
@@ -0,0 +1,28 @@
var assert = require('assert');
var mongo = require('mongodb');
var uri = process.env.MQUERY_URI || 'mongodb://localhost/mquery';
var client;
var db;
exports.getCollection = function(cb) {
mongo.MongoClient.connect(uri, function(err, _client) {
assert.ifError(err);
client = _client;
db = client.db();
var collection = db.collection('stuff');
// clean test db before starting
db.dropDatabase(function() {
cb(null, collection);
});
});
};
exports.dropCollection = function(cb) {
db.dropDatabase(function() {
client.close(cb);
});
};