Node JS - Node js MongoDB Create Collection - MongoDB - Node - Node JS tutorial - webnode




Related nodejs article tags - node js - node js tutorial - node js examples

How to Create Collection of MongoDB in Node.js?

  • MongoDB is a NoSQL database so data is stored in collection instead of table.
  • createCollection method is used to create a collection in MongoDB.
 node-js mongodb create collection

Learn Node js - node js Tutorial - node-js mongodb create collection - node - Node js Examples

Example

  • Create a collection named "employees".
  • learn nodejs - node-js tutorial - mongodb collections - nodejs examples -  nodejs programs
  • Create a js file named "employees.js", having the following data:
var MongoClient = require('mongodb').MongoClient;  
var url = "mongodb://localhost:27017/ MongoDatabase";  
MongoClient.connect(url, function(err, db) {  
if (err) throw err;  
db.createCollection("employees", function(err, res) {  
if (err) throw err;  
console.log("Collection is created!");  
db.close();  
});  
});  

This wikitechy technological portal provides you whole lot of information related to the topics such as mongodb tutorial , what is node js , express js tutorial , node js tutorial pdf , learn node js , node js tutorial for beginners , node js tutorial w3schools , node js express , javascript for beginners , node js express tutorial , node js tutorial point , node js book , node js server , note js , node js mongodb , what is node js used for , why node js , node tutorial , node js basics , tutorialspoint node js , node express , node js sample application , nodeschool , node js for beginners , express tutorial , node js application , use of node js , npm tutorial , node js org , node js training , node js online training , node js tutorial beginner , how to use node js , node js hello world , express node js , node js mongodb tutorial , nodejs http , why use node js

Related Searches to Node.js MongoDB Create Collection