Try   HackMD

MongoDB 中,只有在獲取內容後才會真正建立集合!

建立資料庫

use <name>

建立集合

db.createCollection(<name>)

查看集合

show collections

插入

db.posts.insertOne({
  title: "Post Title 1",
  body: "Body of post.",
  category: "News",
  likes: 1,
  tags: ["news", "events"],
  date: Date()
})

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

查找

db.posts.find()

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

更新第一筆

db.posts.updateOne( { title: "Post Title 1" }, { $set: { likes: 2 } } ) 

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

刪除第一筆

db.posts.deleteOne({ title: "Post Title 5" })

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →