Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Problems with views...

3 replies [Last post]
  • Login or register to post comments
Wed, 01/23/2013 - 19:25
makeawish
Offline
Joined: 12/03/2012
Groups: None

ok, i created a view in the webgui and when i click on the link, i get the desired data like below
the problem is when i eneter i only want to get all docs where key is for example "4.5" i get nothing,
i tried it as key, start end end key so i am not sure what i am missing

{"total_rows":11,"rows":[
{"id":"pic_2d6d865eeff65165e836c7d8e2cc48f7","key":null,"value":["json","4"," picture","source "]},
{"id":"pic_60067e60ddef4373189f8eda7bdb9fd7","key":null,"value":["json","4"," picture","source "]},
{"id":"pic_6hkxiTLHKjhgfdrtyNBHG","key":null,"value":["json","1","picture","2"]},
{"id":"pic_8c4460e7c7db08cd90256a8241772dec","key":null,"value":["json","4"," picture","source "]},
{"id":"pic_e3c81778bbd64380e725755ee63850e8","key":null,"value":["json","4"," picture","source "]},
{"id":"pic_878292cffa8798e7a1b290d75ac68a51","key":[],"value":["json","4","picture","http://590d76d89626af77a1b9-35ebadde38d1538acd42e7a6e421e9fa.r46.cf1.rackcdn.com/878292cffa8798e7a1b290d75ac68a51_4.jpeg"]},
{"id":"pic_6f510153caef708488aaf53a709ba544","key":["4.5"],"value":["json","4","picture","http://590d76d89626af77a1b9-35ebadde38d1538acd42e7a6e421e9fa.r46.cf1.rackcdn.com/6f510153caef708488aaf53a709ba544_4.jpeg"]},
{"id":"pic_e6eb862ff5836e437643e2730ad3d743","key":["4.5","4.3"],"value":["json","4","picture","http://590d76d89626af77a1b9-35ebadde38d1538acd42e7a6e421e9fa.r46.cf1.rackcdn.com/e6eb862ff5836e437643e2730ad3d743_4.jpeg"]},
{"id":"pic_QADMXFGTYHjkPlUjbNTDG","key":["a new folder","test"],"value":["json","1","",""]},
{"id":"pic_6ad0039891ff1548760162107cf8bb99","key":["TEMP"],"value":["json","4"," picture","source "]}
]
}

Top
  • Login or register to post comments
Thu, 01/24/2013 - 02:58
FilipeManana
Offline
Joined: 04/02/2012
Groups: None

I think it would be more helpful if you could:

1) Show us a query, and its output, done with curl for e.g., without any filtering, so that we can see all its content (unless it's too big)

2) Show us the query, and its results (again, with curl for e.g) with the filtering you're trying to do

Assuming what you pasted is the whole view content, querying with ?key="4.5" should return indeed an empty response (but not with ?key=["4.5"]).

Top
  • Login or register to post comments
Thu, 01/24/2013 - 09:11
makeawish
Offline
Joined: 12/03/2012
Groups: None

Ok, adding the [] arround like key seems to fix the problem partialy and i get a single record back.
My Test Data has a key Field which is an Array and i have 2 docs i should be getting returned

key":["4.5"]
key":["4.5","4.3"]

for some reason it only returns the one with key":["4.5"]

what do i need to do to get it to return any record where the key has key "4.5"

Top
  • Login or register to post comments
Thu, 01/24/2013 - 09:18
FilipeManana
Offline
Joined: 04/02/2012
Groups: None

For that case use ?startkey=["4.5"], it should return those 2 rows.
(see http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...)

However this is specific for this particular case. Something like what you say "any record where key contains "4.5"" doesn't quite match how mapreduce queries/views work in Couchbase (and Apache CouchDB). Take a look at the documentation to learn more:

http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views.html

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker