Skip to content

Commit f4f71c6

Browse files
committed
Update mongoapp.js with proper url and change db.collection
1 parent e48771c commit f4f71c6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mongoapp.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
var MongoClient = require('mongodb').MongoClient
22

33
// Open the connection to the server
4-
MongoClient.connect('mongodb://localhost:27017/test', function (err, db) {
4+
MongoClient.connect('mongodb://127.0.0.1:27017/test', function (err, db) {
55
if (err) throw err
66

77
// Find one document in our collection
8-
db.collection.findOne({}, function (err, doc) {
9-
if (err) throw err
8+
db.collection('users').findOne({}, function (err, doc) {
109
// Print the result
1110
console.dir(doc)
1211

0 commit comments

Comments
 (0)