restHeard--串連mongodb介面總結

來源:互聯網
上載者:User

標籤:

名稱 method url 傳參數(JSON) 解釋
建立庫 put http://127.0.0.1:8033/test   建立庫
建立表 put http://127.0.0.1:8033/test/coll   建立表
插入資料 post http://127.0.0.1:8033/test/coll [
    {
        "name": "  王五",
        "age": "30",
       "sex": "女"
    },
    {
        "name": "趙六",
        "age": "35",
        "sex": "男"
    }, {
        "name": "馬七",
        "age": "40",
        "sex": "男"
    }, {
        "name": "丁一",
        "age": "50",
        "sex": "女"
    }, {
        "name": "丁二",
        "age": "30",
        "sex": "女"
    }, {
        "name": "丁三",
        "age": "20",
        "sex": "女"
    }, {
        "name": "丁四",
        "age": "18",
        "sex": "男"
    }
]
插入資料
尋找 get http://127.0.0.1:8033/test/coll   尋找所有的
條件尋找(性別) get http://127.0.0.1:8033/test/coll?filter={‘sex‘:‘女‘}   尋找出所有的女生
排序(根據age) get http://127.0.0.1:8033/test/coll?sort_by=age   根據年齡排序尋找
尋找 get http://127.0.0.1:8033/test/coll?sort_by=age&sort_by=sex   根據age和sex正序排列,如何是反序/test/coll?sort_by=-age  (其他的相同)
尋找 get http://127.0.0.1:8033/test/coll?keys={‘name‘:1 }   只返回name欄位
尋找 get http://127.0.0.1:8033/test/coll?keys={‘name‘:0 }   返回除name的其他欄位
模糊尋找 get http://127.0.0.1:8033/test/coll?filter={‘age‘:{‘$regex‘:‘(^((3[1-9])|([2-9]\d)|([1-9]\d{2,}))$)‘}}" 使用Regex,查出age大於30小於40的人(也可以使用中文如filter={‘name‘: {‘$regex‘:‘丁‘}}")也可以雙重查詢
分頁 get http://127.0.0.1:8033/test/coll?count&page=3&pagesize=2   查出總條數,和第 20 to 29條的資料,每頁顯示兩條
模糊尋找+分頁 get http://127.0.0.1:8033/test/coll?count&page=1&pagesize=4&filter={‘name‘:{‘$regex‘:‘丁‘}}" 分頁尋找+條件模糊尋找
         
         
         
         
         
參考資料地址:     https://softinstigate.atlassian.net/wiki/display/RH01X/Query+Documents    
https://softinstigate.atlassian.net/wiki/pages/viewpage.action?pageId=23461902    
         

restHeard--串連mongodb介面總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.