MongoDB的CURD常用命令

2021-10-09 16:36:03 字數 613 閱讀 4193

選擇切換資料庫:use articledb

插入資料:db.comment.insert()

查詢所有資料:db.comment.find();

條件查詢資料:db.comment.find()

查詢符合條件的第一條記錄:db.comment.findone()

查詢符合條件的前幾條記錄:db.comment.find().limit(條數)

查詢符合條件的跳過的記錄:db.comment.find().skip(條數)

修改資料:db.comment.update(,) 或db.comment.update(,)

修改資料並自增某字段值:db.comment.update(,})

刪除資料:db.comment.remove()

統計查詢:db.comment.count()

模糊查詢:db.comment.find()

條件比較運算:db.comment.find(})

包含查詢:db.comment.find(})或db.comment.find(})

條件連線查詢:db.comment.find(,]})或db.comment.find(,]})

springJdbc常用的curd操作

注入jdbctemplate模板類 resource private jdbctemplate jdbctemplate 新增賬戶記錄,返回受影響的行數 param account return override public int addaccount account account int r...

mongodb 常用命令

以下為基本的常用操作命令 對資料庫操作 檢視所有資料庫 show dbs 刪除當前資料庫 db.dropdatabase 使用資料庫 use 為資料庫名 對collection操作 即sql中的表名 檢視所有collection show collections 檢視collection元素個數 d...

MongoDB常用命令

切換 建立資料庫use yourdb 查詢所有資料庫show dbs 刪除當前使用資料庫db.dropdatabase 從指定主機上轉殖資料庫db.clonedatabase 127.0.0.1 從指定的機器複製資料庫資料到某個資料庫db.copydatabase mydb temp 127.0.0...