2016-03-31 19 views
1

Veri Kovanın içindeki verilerin aşağıdaki diziyi benim Couchbase Server içinde SİTELERİ sahipN1QL sorgu Couchbase Server JSON dizi filtre

"siteMaster": [ 
       { 
        "sitename": "HTS_SITE_001", 
        "sitelink": "http://facebook.com", 
        "address" : "19/2, Bellandur, Bangalore India", 
        "filename": "site1.json", 
        "persons": 1, 
        "status": "70%", 
        "contact": "[email protected]", 
       }, { 
        "sitename": "HTS_SITE_002", 
        "sitelink": "http://facebook.com", 
        "address": "5th Avenue, New York", 
        "filename": "site2.json", 
        "persons": 1, 
        "status": "70%", 
        "contact": "[email protected]", 
       }, { 
        "sitename": "HTS_SITE_003", 
        "sitelink": "http://facebook.com", 
        "address": "Palo Alto, California", 
        "filename": "site3.json", 
        "persons": 1, 
        "status": "80%", 
        "contact": "[email protected]", 
       }, { 
        "sitename": "HTS_SITE_004", 
        "sitelink": "http://facebook.com", 
        "address": "Bellandur, Bangalore", 
        "filename": "site4.json", 
        "persons": 1, 
        "status": "80%", 
        "contact": "[email protected]", 
       } 
      ] 

SİTELERDEKİ yerden seçme

* için N1QL sorgu status = "70%" iki satır döndürmeli, ancak ne yazık ki herhangi bir satır döndürmüyor.

Sorguda nereye yanlış gidiyorum?

CREATE INDEX idx ON SITES(DISTINCT ARRAY sm.status FOR sm IN siteMaster END); 
+0

Couchbase 4.1 veya 4.5 DP yükseltin: Ayrıca sorgu hızlandırmak için aşağıdaki dizi dizin oluşturabilirsiniz

SELECT * FROM SITES WHERE ANY sm IN siteMaster SATISFIES sm.status = "70%" END; 

: – geraldss

+0

@geraldss Bu, 4.5 –

cevap

1

aşağıdaki sorguyu kullanın.
+0

dizinleri siteMaster ile eşleştirmenin bir yolu var mı? –