forked from mongodb/node-mongodb-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest10.js
More file actions
55 lines (44 loc) · 1.77 KB
/
test10.js
File metadata and controls
55 lines (44 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var MongoClient = require('./').MongoClient;
var Logger = require('./').Logger;
// Logger.setLevel('debug');
var url = 'mongodb://candidate.63.mongolayer.com:10649,candidate.64.mongolayer.com:10491/app-staging?replicaSet=set-56be39f36887897ebf0007db';
MongoClient.connect(url, function(err, db) {
console.dir(err)
if (err) throw err;
db.topology.on('serverDescriptionChanged', function(event) {
console.log('received serverDescriptionChanged');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('serverHeartbeatStarted', function(event) {
console.log('received serverHeartbeatStarted');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('serverHeartbeatSucceeded', function(event) {
console.log('received serverHeartbeatSucceeded');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('serverHeartbeatFailed', function(event) {
console.log('received serverHeartbeatFailed');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('serverOpening', function(event) {
console.log('received serverOpening');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('serverClosed', function(event) {
console.log('received serverClosed');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('topologyOpening', function(event) {
console.log('received topologyOpening');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('topologyClosed', function(event) {
console.log('received topologyClosed');
console.log(JSON.stringify(event, null, 2));
});
db.topology.on('topologyDescriptionChanged', function(event) {
console.log('received topologyDescriptionChanged');
console.log(JSON.stringify(event, null, 2));
});
});