Hi, I'm a new nodejs's and javascript's user, i wrote this function
for test that get data form a MongoDB's collection:
function list() {
        var serverMongo = new mongodb.Server("127.0.0.1", 27017, {});
        new mongodb.Db('mytestnode', serverMongo, {}).open(function
(error, client) {
                if (error) throw error;
                var collection = new mongodb.Collection(client,
'mytestcollection');
                collection.find().toArray( function (err, objects) {
                        if (err) {
                                console.warn(err.message);
                        } else {
                                console.log(objects);
                        }
                        serverMongo.close();
                });
        });
}
I call it as a module and i should pass the result to a variable:
client_list = status.list();
I'm trying to set return in all part of the code, without result.
Could you tell some help with this problem?

Thanks for your time.
Best regards.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to