Im newbie in MongoDB. Once started immediately got the error. I have a simple code
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017/mongotest',
function(err, db) {
console.log('Connected to MongoDB!');
// using the db connection object, save the collection 'testing' to
// a separate variable:
var collection = db.collection('testing');
// isert a new item using the collection's insert function:
collection.insert({
'title': 'Snowcrash'
}, function(err, docs) {
// on successful insertion, log to the screen the new
// collection's details:
console.log(docs.length + ' record inserted.');
console.log(docs[0].title + ' – ' + docs[0]._id);
// finally close the connection:
db.close();
});
});
and here is the error message
Help me please to understand what this error and how to fix it. If you do not complicate.
MongoDB version 3.0.7