日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

angularjs增删改查数据_MongoDB数据读写操作(增删改查)总结

發布時間:2025/3/12 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 angularjs增删改查数据_MongoDB数据读写操作(增删改查)总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

《大數據和人工智能交流》頭條號向廣大初學者新增C 、Java 、Python 、Scala、javascript 等目前流行的計算機、大數據編程語言,希望大家以后關注本頭條號更多的內容。

一、在執行mongo.exe文件后,進入MongoDB的shell 操作

1、創建一個數據庫

use users

2、查看所有數據庫 (驗證上面的創建的數據庫是否存在,顯示結果為不存在)

show dbs

3、向users插入數據

db.users.insert({sid:"s001",sname:"lily"});

show dbs

4、刪除數據庫users

use users

db.dropDatabase()

5、在 test 數據庫中創建 users 集合:

db.createCollection("users")

6、查看所有文檔

show collections

或者show tables

二、使用insert() 或 save() 方法向集合中插入文檔

1、插入一維結構的數據

db.goods.insert({goods_id:"g001",gname:"MongoDB",gprice:110});

db.goods.insert({goods_id:"g002",gname:"HBase",gprice:120});

db.goods.insert({goods_id:"g003",gname:"Redis",gprice:130});

2 插入二維結構的數據

db.goods.insert({goods_id:"g006",gname:"spark006",gprice:60,join:{e_mail:"lily006@126.com",tel:"13211111116"}});

db.goods.insert({goods_id:"g007",gname:"spark007",gprice:70,join:{e_mail:"lily007@126.com",tel:"13211111117"}});

db.goods.insert({goods_id:"g008",gname:"spark008",gprice:80,join:{e_mail:"lily008@126.com",tel:"13211111118"}});

3、插入數組結構的數據

db.goods.insert({goods_id:"g009",gname:"spark009",gprice:90,gtype:['book','water']});

三、使用update() 方法用于更新已存在的文檔

步驟1:執行db.goods.find() 查看以前操作過的記錄

在前面插入的如下記錄中執行更新操作,如未插入記錄請先插入記錄:

db.goods.insert({goods_id:"g003",gname:"Redis",gprice:130});

步驟2:將 gname值更新為“MySQL”

db.goods.update({goods_id:"g003",gname:"MySQL",gprice:130});

步驟3:以格式化的方式查看更新后的結果

db.goods.find().pretty()

四、使用remove()方法刪除文檔

步驟1:對某一文檔執行2次操作

db.goods.insert({goods_id:"g011",gname:"Redis",gprice:110});

db.goods.insert({goods_id:"g011",gname:"Redis",gprice:110});

步驟2:使用 find() 函數查看操作結果:

db.goods.find()

步驟3:移除 goods_id:為 'g011' 的文檔:

db.goods.remove({' goods_id ':' g011'})

db.goods.find()

五、 find()查找操作

步驟1:向文檔中插入數據

db.goods.insert({goods_id:"g012",gname:"spark012",gprice:120,gtype:['book','water']});

步驟2:查找所有記錄

db.goods.find()

步驟3:查找一條記錄

db.goods.findOne();

步驟4:按照編號查找記錄

db.goods.find({goods_id:"g012"});

db.goods.findOne({goods_id:"g012"});

《大數據和人工智能交流》的宗旨

1、將大數據和人工智能的專業數學:概率數理統計、線性代數、決策論、優化論、博弈論等數學模型變得通俗易懂。

2、將大數據和人工智能的專業涉及到的數據結構和算法:分類、聚類 、回歸算法、概率等算法變得通俗易懂。

3、最新的高科技動態:數據采集方面的智能傳感器技術;醫療大數據智能決策分析;物聯網智慧城市等等。

根據初學者需要會有C語言、Java語言、Python語言、Scala函數式等目前主流計算機語言。

根據讀者的需要有和人工智能相關的計算機科學與技術、電子技術、芯片技術等基礎學科通俗易懂的文章。

總結

以上是生活随笔為你收集整理的angularjs增删改查数据_MongoDB数据读写操作(增删改查)总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。