CouchbaseView-創(chuàng)新互聯(lián)

Couchbase index: called view -- virtually another document build via map-reduce function

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比保亭黎族網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式保亭黎族網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋保亭黎族地區(qū)。費用合理售后完善,十年實體公司更值得信賴。
  • Map function:
       Call emit() to generate a key-value pair

  • Reduce function:
       Optional (disabled by reduce=false)
       Used to calculate count, sum etc

Query View:

  • Call ViewResult.success() to check whether view execution is successful. Call ViewResult.error()  to see error details

  • Set ViewQuery.debug(true) generate statistics information. Retrieved by  ViewResult.debug()

  • Remember to call ViewQuery.development(true) if a development View has not been published as production view

  • For dev mode, full design doc name is:   _design/dev_[designdoc name],  to query it, just use designdoc name
       If you specify  designdoc name as dev_xxx, you get error:
       com.couchbase.client.java.error.ViewDoesNotExistException: View does not exist
       If you specify designdoc name as  /dev_xxx or  _design/dev_xxx, you get error:
       {"error":"bad_request","reason":"p_w_uploads not supported in Couchbase"}

  • To query composite key, do not use ViewQuery.key(String),  which causes additional quote to be added to the key, add get a json format error:
        invalid UTF-8 JSON  {error,garbage_after_value}
    Uses ViewQuery.key(JsonArray) and JsonArray.from(Object[] array). Each element of array must of correct type (String or Long)

  • To view complete query as url parameter after encoding:  use ViewQuery.toString()

  • Suppose a view composes of 3 field [a, b, c],  it is possible to find documents by  [a, b] only and [a, c] only using that view.  ViewQuery.startKey([a, b, null])  and ViewQuery.startKey([a, null, c])

  • Sort query result:  ViewQuery.desc()

  • References:
    http://docs.couchbase.com/admin/admin/Views/views-writing.html
    http://docs.couchbase.com/admin/admin/Views/views-querySample.html

Bulk operations:

  • Couchbase java sdk supports bulk operation, which improves performance for read/write for a number of documents

  • References:
    http://docs.couchbase.com/developer/java-2.1/documents-bulk.html

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

分享文章:CouchbaseView-創(chuàng)新互聯(lián)
標題URL:http://muchs.cn/article46/coiohg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、Google、關鍵詞優(yōu)化、商城網(wǎng)站、App設計、手機網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設