node.js mongodb tutorial

preview_player
Показать описание
nodejs mongodb tutorial example ,crud example
The sample code

var mongodb = require('mongodb');
var bson = require('bson')

//Step-2 Create A Conection with MongoDB
var server = new mongodb.Server('127.0.0.1','27017',{});
var client = new mongodb.Db('mydb',server,{w:1});

{
if(error)
throw error;
//Create MongoDB Collection
{
if(error)
throw error;
//CREATE/INSERT OPERATION
{
"name":"zariga",
"tutorial":"mongodb tutorial"
},
{safe:true},

function(error,document)
{
if(error)
throw error;

});

//Finding Operation
function(error,results)
{
if(error)
throw error;
}
);

//For Update
{_id: _id},
{$set: {"name": "zarigatongy"}},
{safe: true},
function(err) {
if (err) throw err;
}
);

//Remove
if(error)
throw err;
});

//Again Find
//Finding Operation
function(error,results)
{
if(error)
throw error;
}
);

});

});
Рекомендации по теме
Комментарии
Автор

I really appreciate this video. I tried using other methods from the mongodb's site docs and another method from a different guide, always had unexpected token errors (checked my syntax for hours). This video kept the code clean and readable, works perfectly for me :D. I didn't want to use mongoose either so this implementation was perfect.

matthewsnow
Автор

I don't know why this videos has dislikes, it's to the point and a lot better than the other videos that are either 2 hours long having not more than 15 mins of useful content, or the others that just use a node module to make things easier which really defeats the purpose of making a tutorial since things are already EASY or both.

Anyway, sorry for my long rant and thanks for the video.

youssefzidan
Автор

node.js mongodb tutorial

#Technology #NoSQL #Databases #Nodejs #JavaScript #Database #MongoDB

zarigatongy