Node JS Archive
Insert a document using Node.js and mongoDB Suppose you have a mongoDB database for courses and you want to insert a record into the database using Node.js. First step is to install mongoDB driver for Node.js If it is not already installed. Please open command line and run following command. [crayon-5d139959c8bf1282411379/] This will install mongoDB
NodeJs and Express framework basics We have already learned how to select data from MongoDb using Nodejs findOne. In this article we will create a baisc Hello World program using NodeJs and Express. Consider a following program below. [crayon-5d139959cb42a069446549/] In our first line we need to include ‘express’ module. If express is not already installed
Node Js, MongoDb select record with findOne To select a single record from mongoDB database using findOne() function in Node Js [crayon-5d139959cc0ec773290207/] In the code below we use require function to include the module ‘mongodb’.MongoClient and is assigned to a variable MongoClient [crayon-5d139959cc0fb836685783/] After including mongodb module we have to connect to the server. Consider
Suppose we have a collection in MongoDB database, We want to select data from collection then we can do like the program below. Suppose we have a collection ( Like table in Relational DBMS) named grades and this collection is in course database. Grades collection contains fields like _id, student, grade and so on… now
Node.js is an upcoming new technology that has already got a lot of attention. Top notch tech companies like Microsoft, VMWare, Ebay, Yahoo, and many more are using node. Node.js is the amazing skill to open up new career opportunities for a programmer.