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

Couchbase view on multiple columns with WHERE and ORDER BY clause as in SQL

I am new to Couchbase noSql database. I am trying to create a view, i want this view should give result as below SQL query. SELECT * FROM Employee e WHERE e.name = "DESM%" AND e.salary < 1000 ORDER BY e.id desc Any suggestion is very appreciated.
2
votes
3 answers

Querying "Not In" in Couchbase

I have a set of documents in Couchbase where each may have some users as editors - a set of UserID`s in array. Id like to query all the docs where user with particular userid (username) is not in list of editors? here's what my data looks…
ArkadyB
  • 1,265
  • 1
  • 19
  • 37
2
votes
1 answer

Loop through all documents in a nested function

I started using Couchbase for a new project of mine and I hope you can help me solve a problem. I have two types of documents in my bucket. For example: { "id": "A1", "name": "Name of A", "type": "A" } and { "id": "B1", "name": "Name of…
tobias-kutter
  • 269
  • 2
  • 10
2
votes
2 answers

Couchbase - Get attribute of document referenced by id

I have a 'product' document, which has an attribute 'categoryId' to reference the 'category' document. When I fetch a product, I would like to be able to get the name of the category, not only the id. I know that I should create a view for this, but…
damian
  • 4,024
  • 5
  • 35
  • 53
2
votes
1 answer

Is this a reasonable approach to a .NET custom role provider for a solution utilising couchbase?

I'm currently looking at putting together a .NET role provider for couchbase for use in a project. I'm looking to model this in 2 document types. The first document type is a simple list of all of the roles available in the application. This makes…
Neil F
  • 402
  • 3
  • 8
2
votes
0 answers

Couchbase DocumentSize affecting View-Visibility?

I'm trying to save some larger files (0.1 - 10MB, Images) in Couchbase. Dimensions from 128x128 up to 4096x4096. My problem now is: I am not able to get the keys of larger files in a View. They are simply missing even in the Couchbase-Console and…
anon anon
  • 21
  • 1
2
votes
0 answers

How to do order in grouping(aggregation) in Couchbase?

I have SQL query like this: select count(id) as ct, city from table group by city order by ct desc How can I perform this query in Couchbase? I have map function like This: function (doc, meta) { if(doc.city!==null) { emit(doc.city,1) …
Prakash Thapa
  • 1,285
  • 14
  • 27
2
votes
1 answer

Can updateInterval be set for a design document?

In Couchbase 2.2, I have set the updateInterval parameter both globally (for the view update daemon) and for an individual design document. It appears that only the global setting is always taking effect. On the other hand, if I set updateMinChanges…
RajV
  • 6,860
  • 8
  • 44
  • 62
2
votes
1 answer

Couchbase : view or query on multiple fields (OR)

Is it possible to make a view in Couchbase for something like id=A OR name=A ? Thanks. Cheers, Yann
Yann
  • 135
  • 9
2
votes
1 answer

How to get the document using view in couchbase

I have a requirement wherein I have get the document from couchbase. Following in the Map function that I am using for the same - function (doc, meta) { if (meta.type == "json" && doc!=null) { emit(doc); } } There is no reduce function.…
user1305398
  • 3,550
  • 5
  • 26
  • 42
2
votes
1 answer

How to access json value inside reduce function in couchbase?

my reduce function in Couchbase[just for testing] : function(keys,values,reduce){ return values[0]; } The result is here {"rows":[ {"key":null,"value":{"doctype":"closed_auctions","buyer":"person14108"}} ] } I would like to get individual value…
Prakash Thapa
  • 1,285
  • 14
  • 27
2
votes
1 answer

Overcoming querying limitations in Couchbase

We recently made a shift from relational (MySQL) to NoSQL (couchbase). Basically its a back-end for social mobile game. We were facing a lot of problems scaling our backend to handle increasing number of users. When using MySQL loading a user took a…
umair
  • 957
  • 1
  • 9
  • 21
2
votes
2 answers

Local Testing of Couchbase Views

I am developing Couchbase views and using the console is limiting because the output lines are truncated and JavaScript errors are not displayed. Is there a convenient way to test views locally with an engine like Node.js? Thanks!
user1398968
  • 215
  • 2
  • 6
2
votes
1 answer

Couchbase view sharing between buckets

We are a group of developers where everybody has their own bucket - but the same views. I'd like to have one file with views defined under source control. This file shall then be somehow easily applicable to existing bucket so that views on this…
Lubos
  • 41
  • 5
1
vote
1 answer

Javascript large Number parsing

I am using a Couchbase view to emit a few records. Among those records, there is one record which is 19 digit long. When Couchbase view (written in javascript) pulls those record, it rounds off the record into smaller one and loses…
deewreck
  • 113
  • 7