Created
April 25, 2016 08:52
-
-
Save wumingyu12/93819c505a169bb395c82e6dc6d4af85 to your computer and use it in GitHub Desktop.
node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 1.npm install mongodb -save | |
| 2.确保mongodb服务启动 | |
| 3.ndoe “这个文件名” | |
| */ | |
| var MongoClient = require('mongodb').MongoClient; | |
| var assert = require('assert'); | |
| var url = 'mongodb://localhost:27017/test'; | |
| MongoClient.connect(url, function(err, db) { | |
| assert.equal(null, err); | |
| console.log("Connected correctly to server."); | |
| db.close(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment