How to run a mongo ping?

3,043 views
Skip to first unread message

Tim Haines

unread,
Sep 2, 2013, 6:04:29 PM9/2/13
to meteo...@googlegroups.com
Hi guys,

I'm trying to troubleshoot slowdowns that are occurring - observes occasionally taking 4 seconds to initialize etc.  One of the things I'd like to do is use mongo's ping command.  Can anyone suggest how I might be able to use Meteor's mongo connection in order to call the ping command?


I see the mongo npm module has it available as Admin.ping, but I'm not sure how to call it: https://github.com/mongodb/node-mongodb-native/blob/master/lib/mongodb/admin.js#L100

Cheers,

Tim.
Message has been deleted

Arunoda Susiripala

unread,
Sep 3, 2013, 8:44:40 PM9/3/13
to meteo...@googlegroups.com
This might work.
col = new Meteor.Collection('ffg');
  Meteor.setTimeout(function() {
    var mongo = Npm.require('mongodb');
    var db = col.find()._mongo.db;
    console.log(db);
    var adminDb = new mongo.Admin(db);
    adminDb.ping();
  }, 1000);

Not tested.
You might need use my npm package to get mongodb npm module.
Reply all
Reply to author
Forward
0 new messages