diff options
| author | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-21 23:25:55 +0000 |
|---|---|---|
| committer | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-21 23:25:55 +0000 |
| commit | dc3888553bdda4ee30e6440992459916cec8d911 (patch) | |
| tree | 3103577d8ca32f798e88468da305e26ff260bf5b /node_simple.js | |
| parent | 39ef1b6fd37bb9b725676d3a98f13e3450798200 (diff) | |
Need pull
Diffstat (limited to 'node_simple.js')
| -rw-r--r-- | node_simple.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/node_simple.js b/node_simple.js index b611302..5f91c0e 100644 --- a/node_simple.js +++ b/node_simple.js @@ -52,6 +52,7 @@ Object.assign = require('object-assign'); var mongodb = require('mongodb'); var mongoFactory = require('mongo-factory'); var ObjectId = require('mongodb').ObjectID; +var assert = require('assert'); // Standard URI format: mongodb://[dbuser:dbpassword@]host:port/dbname //var uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo'; @@ -545,6 +546,26 @@ exports.get_exam_byID = function (id) { /* IGNORE BELOW ********************************************************************************* + + /* + * userObj = {fs: fs, ls: ls, email: email, username: username, pass_hash: pass_hash, univ: univ, dept: dept} + * + * */ +exports.addUser = function (userObj) { + mongoFactory.getConnection(uri) + .then(function(db) { + var users = db.collection('users').insertOne(userObj, function (err, result) { + assert.equal(null, error); + console.log("User inserted"); + db.close(); + }); + + }); +} + + +exports.findUser = function () + ONLY FOR SYNTAX REFERENCE /!* |
