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
0
votes
1 answer

Force couchbase to update view index while integration testing

I'm looking to integration test my Couchbase implementation and i'm running into a problem with the eventually-consistent nature of Couchbase. In production, it's perfectly ok for my data to be stale, but at test time i'd like to insert some data…
MarcusP
  • 15
  • 3
0
votes
2 answers

Couchbase - Order of saving documents in memory and on disk

Does Couchbase store documents in-memory first before moving the data to filestore? Is there any configuration available to specify how long the data has to be store in-memory before it can be flushed to file store?
Punter Vicky
  • 15,954
  • 56
  • 188
  • 315
0
votes
1 answer

Couchbase view using “WHERE” clause dynamically

I have Json Documents in the following format Name : Class : City : Type : Age : Level : Mother : Father : I have a map function like this function(doc,meta) { emit([doc.Name,doc.Age,doc.Type,doc.Level],null); } What I can do is give "name"…
Legendary_Hunter
  • 1,040
  • 2
  • 10
  • 29
0
votes
1 answer

Skipping a key parameter in couchbase map function

I Have a map function function (doc, meta) { emit([doc.Marks,doc.Acc_no],doc.Type); } In this when I send startkey and endkey as follows startkey = [13] endkey = [86] I get all the documents having marks between 13 and 86 as expected…
Legendary_Hunter
  • 1,040
  • 2
  • 10
  • 29
0
votes
1 answer

Simple "count()" query with Spring Data Couchbase

I'm having a problem I don't seem to find a solution for, and it looks really odd given i've tried everything I could with the official Spring Data Couchbase documentation. Basically all i'm trying to do is a simple count() method. My Repository :…
0
votes
1 answer

Couchbase view documents older than one month

I am trying to create a couchbase view which retrieve the IDs of all the views that haven't been updated for more than one month. They also should not have the string ID in their key: function (doc, meta) { if (meta.id.indexOf("ID") == -1) { …
Ido Barash
  • 4,856
  • 11
  • 41
  • 78
0
votes
1 answer

couchbase timeout exception using Spring Data

spring-data-couchbase 2.0.0.RELEASE 4.0.0-4047 Community Edition (build-4047) At times I face connection timeout exception being thrown Caused by: com.couchbase.client.deps.io.netty.channel.ConnectTimeoutException: connection timed out I am…
0
votes
1 answer

Couchbase View Consistency

The following code guarantees that any given document will be saved in a durable manner to the active node in a Couchbase cluster, as well as replicated to 1 additional node: cas, err := myBucket.UpsertDura(docToStore, valueToStore, 1, 1) Given…
Paul Mooney
  • 1,576
  • 12
  • 28
0
votes
1 answer

Couchbase View not returning array value

I am trying to create a view to group on a particular attribute inside an array. However, the below map function is not returning any result. JSON Document Structure : { "jsontype": "survey_response", "jsoninstance": "xyz", "jsonlanguage":…
modek
  • 1
0
votes
1 answer

Updating a couchbaselite design document does not alter my view result

I am developing a react-native application and I am using Couchbase lite as a database locally. The way this works is that you spawn a local REST server when the app starts and you use the REST API to communicate with the CouchbaseLite server. I…
Mosselman
  • 1,718
  • 15
  • 27
0
votes
2 answers

Composite key querying in couchbase 4.0

I got a view like this: function (doc, meta) { if(doc.type){ var id = doc.id ? doc.id: ""; var company = doc.company ? doc.company: ""; var store = doc.store ? doc.store: ""; emit([doc.type, id, company, store]); } } And…
Igl3
  • 4,900
  • 5
  • 35
  • 69
0
votes
1 answer

Set development mode for view query in Couchbase Java SDK 2 globally?

I am using play framework with Couchbase. Play framework has a feature of app modes: dev, test, prod. Couchbase view engine also has modes: dev, prod. I want to query all Couchbase views in dev mode while in play framework dev mode and query views…
Anton Ivinskyi
  • 402
  • 5
  • 17
0
votes
1 answer

Querying Couchbase Views using Keys() parameter, can we implement the EqualsIgnoreCase in case of String.?

I have a use case where I want to query couchbaseViews using the Keys() function like this. ViewQuery.from(documentDesignName, viewName).stale(Stale.FALSE).keys(["riya","astha"]) So if in the data base "Riya" would be present , its not returning me…
Shivansh
  • 3,454
  • 23
  • 46
0
votes
1 answer

Is it possible to store view code in files?

Right now I enter view code (map & reduce) in the couchbase UI. This is very inconvenient, and I was wondering if there is a way to make couchbase scan the code from a folder? This will allow me to put this code under version control, and allow me…
Moshe Shaham
  • 15,448
  • 22
  • 74
  • 114
0
votes
1 answer

Couchbase 4.0 Data Modelling

I have an application with entities like User, Message and MessageFeatures. Each User can have many messages and each message has a MessageFeatures entity. Currently the relational model is expressed as: User{ UUID id String email …
gladiator
  • 722
  • 1
  • 9
  • 16