Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add close example, close #29

  • Loading branch information...
commit e681674fe11523c91340ae86f58b842a11bb6076 1 parent e312e01
@guileen authored
Showing with 18 additions and 0 deletions.
  1. +15 −0 examples/close.js
  2. +3 −0  examples/config.js
View
15 examples/close.js
@@ -0,0 +1,15 @@
+var db = require('./config').db;
+
+db.collection('test').findOne({}, function(err, data) {
+ if(!err) {
+ console.log('db has open');
+ console.log(data);
+ }
+});
+
+process.on('SIGINT', function() {
+ console.log('Recieve SIGINT');
+ db.close(function(){
+ console.log('database has closed');
+ })
+})
View
3  examples/config.js
@@ -0,0 +1,3 @@
+var mongoskin = require('../lib/mongoskin/');
+
+exports.db = mongoskin.db('localhost/test');
Please sign in to comment.
Something went wrong with that request. Please try again.