**Problem**

Hello. I'm just doing a simple test project in Node.js and MongoDB and I'm having some trouble getting data from a document. I made a function to retrieve data from the database and put the function in a module. Please see my document format as well as my code below. I really don't know what the problem is.

**Document Format**

```
{
    "email" : "example@helpme.com",
    "name" : "John Smith",
}

```

**Function Code**

```
module.exports = {
    GetInfo: function(MongoClient, assert, baseValues, targetField) {
        var result = "";
        MongoClient.connect(db_link, function(err, db) {
            assert.equal(null, err);
            var doc = db.collection('userdata').find(baseValues);
            if (doc != null) {
                result = doc[targetField];
            } else { db.close(); }
        });
        return result;
    },
}

```

**Function Call**

```
var MongoClient = require('mongodb').MongoClient;
var assert = require('assert');
var name = GetInfo(MongoClient, assert, { "email":"example@helpme.com" }, "name");
console.log(name);

```