Node.js ကျူတိုရီရယ်

Node.js ပင်မစာမျက်နှာ Node.js နိဒါန်း Node.js ကို စတင်လိုက်ပါ။ Node.js မော်ဂျူးများ Node.js HTTP မော်ဂျူး Node.js ဖိုင်စနစ် Node.js URL မော်ဂျူး Node.js NPM Node.js ပွဲများ Node.js ဖိုင်များ အပ်လုဒ်လုပ်ခြင်း။ Node.js အီးမေးလ်

Node.js MySQL

MySQL စတင်လိုက်ပါ။ MySQL ဒေတာဘေ့စ်ဖန်တီးပါ။ MySQL ဇယားဖန်တီးပါ။ MySQL ထဲသို့ ထည့်သွင်းပါ။ MySQL မှ ရွေးချယ်ပါ။ MySQL ဘယ်မှာလဲ။ MySQL Order By MySQL ကိုဖျက်ပါ။ MySQL Drop Table MySQL အပ်ဒိတ် MySQL ကန့်သတ်ချက် MySQL Join

Node.js MongoDB

MongoDB စတင်လိုက်ပါ။ MongoDB ဒေတာဘေ့စ်ဖန်တီးပါ။ MongoDB သည် Collection ကိုဖန်တီးပါ။ MongoDB ထည့်သွင်းပါ။ MongoDB ကိုရှာပါ။ MongoDB မေးခွန်း MongoDB အမျိုးအစား MongoDB ကိုဖျက်ပါ။ MongoDB Drop Collection MongoDB အပ်ဒိတ် MongoDB ကန့်သတ်ချက် MongoDB Join

Raspberry Pi

RasPi စတင်လိုက်ပါ။ RasPi GPIO နိဒါန်း RasPi မှိတ်တုတ်မှိတ်တုတ် LED RasPi LED နှင့် ခလုတ်နှိပ်ပါ။ RasPi စီးဆင်းနေသော LED များ RasPi WebSocket RasPi RGB LED WebSocket RasPi အစိတ်အပိုင်းများ

Node.js အ ကိုး အကား

Built-in Modules များ

Node.js MongoDB စုစည်းမှုကို ဖန်တီး ပါ။


MongoDB တွင် စုစည်းမှု တစ်ခုသည် MySQL ရှိ ဇယား တစ်ခုနှင့်အတူတူဖြစ်သည်။

စုစည်းမှုဖန်တီးခြင်း။

MongoDB တွင် စုစည်းမှုတစ်ခုကို ဖန်တီးရန်၊ createCollection()နည်းလမ်းကို အသုံးပြုပါ-

ဥပမာ

"ဖောက်သည်များ" ဟုခေါ်သော စုစည်းမှုတစ်ခုကို ဖန်တီးပါ-

var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  var dbo = db.db("mydb");
  dbo.createCollection("customers", function(err, res) {
    if (err) throw err;
    console.log("Collection created!");
    db.close();
  });
});

"demo_mongodb_createcollection.js" ဟုခေါ်သော ဖိုင်တစ်ခုတွင် အထက်ကုဒ်ကို သိမ်းဆည်းပြီး ဖိုင်ကို ဖွင့်ပါ။

"demo_mongodb_createcollection.js" ကိုဖွင့်ပါ

C:\Users\Your Name>node demo_mongodb_createcollection.js

သင့်အား ဤရလဒ်ကို ပေးလိမ့်မည်-

Collection created!

အရေးကြီးသည်- MongoDB တွင်၊ အကြောင်းအရာမရရှိမချင်း စုစည်းမှုတစ်ခုကို ဖန်တီးမထားပါ။

MongoDB သည် စုစည်းမှုကို အမှန်တကယ်မဖန်တီးမီ စာရွက်စာတမ်းတစ်ခုကို သင်ထည့်သွင်းပြီးသည်အထိ စောင့်ပါသည်။