創(chuàng)新互聯(lián)www.cdcxhl.cn八線動(dòng)態(tài)BGP香港云服務(wù)器提供商,新人活動(dòng)買(mǎi)多久送多久,劃算不套路!
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:空間域名、網(wǎng)頁(yè)空間、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、蒼溪網(wǎng)站維護(hù)、網(wǎng)站推廣。小編給大家分享一下mongodb查詢語(yǔ)句的案例,相信大部分人都還不怎么了解,因此分享這邊文章給大家學(xué)習(xí),希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去學(xué)習(xí)方法吧!
如果覺(jué)得 Mongodb 語(yǔ)句不太好理解,可以和 SQL 語(yǔ)句進(jìn)行對(duì)比,學(xué)起來(lái)要容易很多。
查詢(find)
查詢所有結(jié)果
select * from article db.article.find()
指定返回哪些鍵
select title, author from article db.article.find({}, {"title": 1, "author": 1})
where條件
select * from article where title = "mongodb" db.article.find({"title": "mongodb"})
and條件
select * from article where title = "mongodb" and author = "god" db.article.find({"title": "mongodb", "author": "god"})
or條件
select * from article where title = "mongodb" or author = "god" db.article.find({"$or": [{"title": "mongodb"}, {"author": "god"}]})
比較條件
select * from article where read >= 100; db.article.find({"read": {"$gt": 100}}) > $gt(>)、$gte(>=)、$lt(<)、$lte(<=) select * from article where read >= 100 and read <= 200 db.article.find({"read": {"$gte": 100, "lte": 200}})
in條件
select * from article where author in ("a", "b", "c") db.article.find({"author": {"$in": ["a", "b", "c"]}})
like
select * from article where title like "%mongodb%" db.article.find({"title": /mongodb/})
count
select count(*) from article db.article.count()
不等于
select * from article where author != "a" db.article.find({ "author": { "$ne": "a" }})
以上是mongodb查詢語(yǔ)句的案例的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!
分享題目:mongodb查詢語(yǔ)句的案例-創(chuàng)新互聯(lián)
文章起源:http://vcdvsql.cn/article24/csesce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、企業(yè)網(wǎng)站制作、網(wǎng)站內(nèi)鏈、定制開(kāi)發(fā)、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容