Questions tagged [couchbase-view]

Couchbase views allow you to extract specific fields and information from data and create an easily accessible index.

The purpose of a view is to take the unstructured or semi-structured data stored within your Couchbase Server database, extract the fields and information you want, and produce an index of the selected information. Storing information in Couchbase Server using JSON makes the process of selecting individual fields for output easier. The resulting structure that is generated is a view on the stored data. The view that is created during this process lets you iterate, select, and query the information in your database from the raw data objects that have been stored.

Common pitfalls when using views:

  • Do not return entire docs using views. Rather, use the “attach doc” flag. Another solution is to emit just the object IDs and then do a parallelized bulk operation to get all of the relevant objects.
  • Views work only on data that has been persisted to disk
  • Views may return docs with expired TTL
  • Publish your view or else you may receive partial data
  • Do not use too many views – if you need to use more than 10-15 views, you should instead use N1QL or create a standardized key pattern to access your data via the key

Resources:

208 questions
10
votes
3 answers

Couchbase - When should i use N1QL vs Views?

I'm learning Couchbase, now on version 3.x My doubt is, when should i use a N1QL query vs a View query? And, are there performance differences between them? Note: I have a situation: A Bucket with two document types for my Traveling App: Route and…
user1031721
9
votes
2 answers

max number of couchbase views per bucket

How many views per bucket is too much, assuming a large amount of data in the bucket (>100GB, >100M documents, >12 document types), and assuming each view applies only to one document type? Or asked another way, at what point should some document…
Justin Francis
  • 248
  • 4
  • 10
8
votes
2 answers

Best practice to store couchbase views

My application has couchbase views (map-reduce). Presently, I am writing them on a text file and loading them for each new couchbase server from the couchbase admin page (tedious and error-prone process). Is there anyway I can load all those views…
aneez
  • 693
  • 1
  • 7
  • 18
7
votes
0 answers

High CPU usage on couchbase server with moderate load

I am using Couchbase Server on stage environment. Things were working fine until yesterday. But since today I am observing high CPU usage when the load is increased moderately. (PFA) Couchbase cluster configuration:- 3 node cluster running…
sandy
  • 1,153
  • 7
  • 21
  • 39
6
votes
2 answers

error (Reducer: ) when attempting to do distinct reduce

I am getting an error when trying to do a DISTINCT reduce that I got from here. I have reproduced this error on the beer-sample bucket, so this should be easy to reproduce. I have not seen any errors in the mapreduce_errors.txt file, or anything…
Blue
  • 22,608
  • 7
  • 62
  • 92
5
votes
3 answers

Search for documents within a given radius with Couchbase

I want to write a geospatial view that takes searches for the following document within a one mile radius from a given latitude and longitude. How do I do this? { "agree_allowed":true, "assigned_by":"", "assigned_to":"", …
rash
  • 91
  • 7
5
votes
1 answer

CouchBase Lite, exclude documents with certain keys in query

I have a simple view with mapper that emits docs with some keys. com.couchbase.lite.View view = database.getView(VIEW_NAME); if (view.getMap() == null) { Mapper map = new Mapper() { @Override public void…
Andrii Bas
  • 613
  • 1
  • 6
  • 20
5
votes
2 answers

Couchbase query based on time

I've been trying to figure out how to get data back based on a timestamp. Basically I want to query 100 docs based on a timestamp field. the 100 docs should be older than the timestamp I passed it. Also I want to create a refresh where I can pass a…
Michael
  • 1,241
  • 1
  • 13
  • 25
5
votes
1 answer

Couchbase View not update immediately?

I just follow this post to test Couchbase View.When edit view use Couchbase GUI and save,the view didn't update immediately. For example.With php scripts store some array to Couchbase.And define a named 'last' view in 'dev_sessions'…
qkboy
  • 208
  • 3
  • 7
4
votes
2 answers

What is Couchbase Environment autoreleaseAfter option?

After using a bit of the java client API of Couchbase (2.4.1) I ran into this exception: Error in scheduled task java.lang.IllegalStateException: The Content of this Observable is already released. Subscribe earlier or tune the…
zenbeni
  • 7,019
  • 3
  • 29
  • 60
4
votes
2 answers

Couchbase Sync Gateway- Server and Client API vs bucket shadowing

I am working on a project that uses Couchbase Server and Sync Gateway to synchronize the contents of a bucket with iOS and Android clients running Couchbase Lite. I also need read and write access to the Couchbase Server from a Node.js server…
gcc
  • 283
  • 1
  • 3
  • 14
4
votes
1 answer

Is there way to return all data from couchbase view

I wrote a Couchbase view and I'm querying this view from Python. Instead of the full set of data being returned, it is only returning the first 10 elements. I don't want pagination, instead of pagination I want the entire set of data. Is there any…
rash111
  • 1,307
  • 4
  • 19
  • 35
4
votes
2 answers

Querying couchbase by passing some value dynamically

I am having couchbase documents stored in below format: { "userEmail": "satyam@xyz.com", "hashedPassword": "$2a$12$MT31FHNEbOAKpQGzLdBB3uhLlPlGNU0cvsgi/2pt4TdwPjvrUzkSG", "type": "user", } I want to read only the document which is having userEmail…
Yo Yo Saty Singh
  • 539
  • 1
  • 6
  • 15
4
votes
1 answer

CouchBase view get for multiple ranges

I'm evaluating CouchBase for an application, and trying to figure out something about range queries on views. I know I can do a view get for a single key, multiple keys, or a range. Can I do a get for multiple ranges? i.e. I want to retrieve items…
David Pfeffer
  • 38,869
  • 30
  • 127
  • 202
4
votes
1 answer

Couchbase view not updating after set from PHP SDK

I am working on an application, where I work mainly with views for getting the data. What I try to do is, to store a document, redirect and check if the stored document is available(this is done via view, because I am not looking for the document…
tombul
  • 1,747
  • 1
  • 12
  • 11
1
2 3
13 14