FAQ Database Discussion Community


In Couchbase or N1QL how can I check if the values in an array match

views,couchbase,n1ql
In a couchbase I have the following document structure... { name: "bob", permissions: [ 2, 4, 6 ] } I need to be able to create a view, or N1QL query which will check if the permissions for "bob" are contained within a given array. e.g I have an array...

Check-and-set in Couchbase Java SDK 2.x?

java,couchbase,optimistic-locking
In older version of Couchbase Java SDK there were several check-and-set (CAS) methods for implementing optimistic locking. But what is corresponding API in a newer version of SDK (>= 2.0)? Initial code: JsonDocument doc = bucket.get("myKey"); Long casValue = doc.cas(); // some method to set new value for "myKey" only...

Couchbase reduce multiple values

couchbase,couchbase-view
I am building a view in Couchbase 3.0.1 and would like to reduce multiple values from a map, but I am not sure the right approach. In the case of an order object, the problem I am trying to solve is that I would like to reduce multiple values from...

How does Couchbase swap rebalance work?

couchbase
I am trying to understand how data consistency is maintained during an Online upgrade with incoming operations to the database using swap rebalance. When I say swap rebalance (with 1 node added and removed), data from one node is copied to the newly added node. During this transition time, what...

Is there any direct method to fetch data from a Couchbase server to R Studio?

rstudio,couchbase
I'm fairly new to this issue with virtually no experience with Couchbase, so i might just overlooked some easy and direct way to access data contained in it to R Studio. Do you guys know about a solution? Do i have to process such queries through some other platforms? Any...

Spring Session – Support for other Backend Implementations other then Redis [closed]

spring,redis,spring-boot,couchbase,spring-session
I would like to use "Spring Session" in my current project, but it seems that currently only Redis is a supported backend database. The official documentation is not talking about any other support yet. Are there alternative implementations for other databases? For example, what about Memcached or Couchbase Support, which...

Couchbase on Nodejs - how the add () method works?

javascript,node.js,nosql,couchbase
It's a basic question but i'm learning couchbase now and in my fail i'm trying to insert Data into my couchbase instance with the add() method. But something in my code doesnt work well and i dont know why. var http = require("http"); var driver = require('couchbase'); var cb =...

What's the benefits of using a design document?

views,couchbase
While reading Couchbase document, I've came across the following. Because the index for each map/reduce combination within each view within a given design document is updated at the same time, avoid declaring too many views within the same design document http://docs.couchbase.com/admin/admin/Views/views-writing.html If that's the case, why does it even allow...

Understanding Moxi stats field “total_connections”

couchbase,membase,moxiemanager
What do the following fields means in the Moxi stats counters? I understand the "curr_connections" which counts both client connections into moxi and also moxi’s connections to downstream Couchbase servers. What does the counter "total_connections" represent? STAT memcached:stats:curr_connections 1140 STAT memcached:stats:total_connections 884426 ...

How to update(in-place) the JSON document in couchbase?

couchbase
I want to add a field in an existing document in couchbase. For an example, lets say we have below document in couchbase default bucket: {"first_name":"Abc", "last_name":"Mno"} Now I want to add a new field in the json document so that it becomes: {"first_name":"Abc", "last_name":"Mno", "city":"Xyz"} I know this feature...

Creating Couchbase views in code: First query returns 0 rows, index builds in background

java,couchbase,couchbase-view,couchbase-java-api
I am creating a view in code using the Couchbase Java API 2.1.2 like this: DefaultView view = DefaultView.create(viewName, jsMapFunctionAsString); List<View> views = new ArrayList<>(); views.add(view); DesignDocument doc = DesignDocument.create(name, views); bucket.bucketManager().insertDesignDocument(doc); Calling ViewResult result = bucket.query(ViewQuery.from(name, viewName)) directly after inserting the document, viewResult.success() always returns true, but both iterators...

elasticsearch couchbase-transport plugin not listening

plugins,elasticsearch,couchbase
I have some Couchbase servers, and I have a dedicated Elasticsearch server with the couchbase-transport plugin. My Elasticsearch settings : network.publish_host: 192.X.X.X network.host: 192.X.X.X netstat -laputen | grep 9300 : 192.X.X.X:9300 My Elasticsearch service is listening correctly on the IP, but when I use netstat for the port of the...

Using couchbase as memcache in a cluster configuration

python,django,memcached,couchbase,high-availability
I've got a couchbase cluster that also serves as a 'drop-in' replacement for memcached in my Django-based production environment. In other words: in my django configuration I provided one of my couchbase nodes as the 'Location' for the memcache service. This works well - but creates a single point of...

Spring Data-Couchbase Client Configuration with moxi Client Possible?

spring-data,couchbase,spring-data-couchbase
We are running client-side MOXI on the same machine as our Tomcat servers, with MOXI currently talking to a cluster of membase servers on 3 different machines. The java clients talk to MOXI using spymemcached communicating to MOXI through data port 11211. We are going to migrate to Couchbase now...

Couchbase Bulk loading error with upsert() (.NET SDK 2.0)

c#,.net,collections,couchbase,upsert
I have encountering an error when inserting bulk data with the upsert function and cannot figure out how to fix it. Anyone know what is wrong here? What the program is essentially doing is grabbing data from a SQL server database and loading into our Couchbase bucket on an Amazon...

Why does the Couchbase Server API require a name for new documents

couchbase
When you create a document using the Couchbase Server API, one of the arguments is a document name. What is this used for and why is it needed? When using Couchbase Lite you can create an empty document and it is assigned an _id and _rev. You do not need...

How to manage Roles in Couchbase?

error-handling,passport.js,roles,couchbase,couchbase-sync-gateway
I have a Couchbase backend hosted in a remote server and I want to update my sync function in order to grant data access to users. The users are generated by Passport.js, and my trouble is to perform basic CRUD operations on roles. The official documentation says that the RESTful...

Is application change required when new couchbase node added to cluster?

javascript,node.js,sdk,documentation,couchbase
I am using Node.js SDK to connect to a couchbase cluster. In Node.js docs they haven't specified how to pass multiple ips(of cluster nodes) while creating the cluster object but java docs shows it can accept array of IPs, is this functionality available in Node.js SDK too? Also if this...

Running couchbase on AWS under auto scaling

couchbase
I want to run couchbase on AWS EC2. Since my traffic is cyclic in nature, can I run Couchbase under auto-scaling. Since there are a lot of steps required to add/remove a node, I was wondering if this is the right approach. Has anybody tried it ?

Couchbase SDK and Moxi Client

couchbase
I am new to Couchbase and trying to understand why we need a Client side proxy like Moxi if using a Couchbase PHP SDK. As per my understanding the proxying of client requests to right server is done by the Client SDK which maintains the vBucket map of all keys....

Upsert in N1QL: How to count-up a value of an existing document

couchbase
I want to INSERT a document based on unique key or UPDATE a counter if the document already exists. In the UPSERT documentation of DP4 I found an example that indicates that UPSERT is more like an INSERT or REPLACE. UPSERT INTO product (KEY, VALUE) VALUES ("EAN1234567", { "productId": "EAN1234567",...

Couchbase: How to create JsonObject from a java Object

java,json,couchbase
How to easily convert/parse the Java Object into a JSON object that is a instance com.couchbase.client.java.document.json.JsonObject? I tried to do this: import com.couchbase.client.deps.com.fasterxml.jackson.annotation.JsonProperty; public class MyClass { @JsonProperty("filed") private String filed; public MyClass(String filed) { this.filed = filed; } public String getFiled() { return filed; } and run this lines...

Which couchbase node will serve request?

node.js,caching,couchbase,couchbase-nodejs-sdk
I am having NodeJS service which talks to couchbase cluster to fetch the data. The couchbase cluster has 4 nodes(running on ip1, ip2, ip3, ip4) and service also is running on same 4 servers. On all the NodeJS services my connection string looks like this: couchbase://ip1,ip2,ip3,ip4 but whenever I try...

how do you access the values in a couchbase view?

view,go,couchbase
I have a widget.json file which is loaded into a document in couchbase: { "type": "widget", "name": "clicker", "description": "clicks!" } I also have a couchbase design document, couchbase.ddoc, for a bucket. It is registered with the name "views": { "_id": "_design/accesscheck", "language": "javascript", "views": { "all_widgets": { "map": "function(doc,...

Does rxjava with couchbase offer value for non-bulk opertions

java,couchbase,reactive-programming,rx-java
The new Couchbase SDK makes bulk operations easier to use and more performant use rx-java. But is there any value to using rx for operations on single values? If we look at a simple CAS / insert operation, ie if the value exists do a cas else do an insert...

Delete multiple couchbase entities having common key pattern

node.js,couchbase,couchbase-nodejs-sdk,bulk-delete
I have a use case where I have to remove a subset of entities stored in couchbase, e.g. removing all entities with keys starting with "pii_". I am using NodeJS SDK but there is only one remove method which takes one key at a time: http://docs.couchbase.com/sdk-api/couchbase-node-client-2.0.0/Bucket.html#remove In some cases thousands...

Querying multiple fields at a time on a view

couchbase
I have a scenario wherein in my application a user will be searching by search criterias (say field1, field2, field3 (field 3 is a daterange)). Field1 is a mandatory search criteria, but fields 2...5 are optional and they can come as combinations through user input. So I created a single...

Large log data in Couchbase

couchbase
I have a couchbase server to storing a huge data. This data growing daily, but i also daily delete after process it. Current, this data has about 1320168 items count, with 2.97G of Data Usage But why Disc Usage is very large with 135G ??? My disc is lowing space...

Does a bucket span over all nodes in a Couchbase Server cluster?

nosql,views,couchbase,couchbase-bucket
I've been reading through the Couchbase Server documentation, and as I understand it, this is "how it all works": A cluster has one or more nodes (servers). A cluster has one or more buckets. A bucket has one or more views. My questions: I would assume that the data in...

Sync Gateway creates one document per change when used with Couchbase-lite

couchbase,couchbase-lite,couchbase-sync-gateway
From what I have observed: For every document you create, a revision-manager document is also created. This revision-manager keeps track of the latest revision and also maintains a history of all revisions in an array. Every time you update a document, a new document is created (whyyyyy???). The revision-manager document's...

How check error codes with couchbase gocb?

go,couchbase
When handling errors returned by gocb (the official Couchbase Go Client) I would like to check for specific status codes (e.g. StatusKeyNotFound or StatusKeyExists). Like so _, err := bucket.Get(key, entity) if err != nil { if err == gocb.ErrKeyNotFound { ... } } Can this be done?...

Couchbase - retrieving multiple documents using key prefix

couchbase,couchbase-nodejs-sdk
in Couchbase DB, is it possible to retrieve multiple documents using key prefix as query string, and it returns all the key-values which has key starting with supplied key prefix (like operator kind of thing)? without using Views or queries/indices. I am designing my keys the way it is shown...

How to insert raw json in Couchbase with the .NET client?

.net,couchbase
I'm working on a REST API for CRUD operations on Couchbase. The Idea is to send directly to the backend the RAW Json coming from the request body. There should be no serialization at all done by the Couchbase client. You can actually get a document back from the store...

What is the recommended way to watch for changes in a Couchbase document?

couchbase,change-tracking
I want to use Couchbase but I want to implement change tracking in a few areas similar to the way RethinkDB does it. There appears to be a hand full of ways to have changes pushed to me from a Couchbase server. DCP TAP XDCR Which one is the correct...

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

couchbase,couchbase-view,spring-data-couchbase
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. ...

How to solve the indexing error in couchbase elasticsearch replication?

elasticsearch,replication,couchbase
I'm Trying to solve the issue while replicating my data from couchbase server to elasticsearch. Error while replicating : Object mapping [place] trying to serialize a value with no field associated with it, current value [placeName] My document is { "Name":"personname", "address":[], place:["placeName"], "zipCode" :"zipcode" } If this document is...

What's a Cluster / Bucket in couchbase Server

server,cluster-computing,couchbase,bucket
I'm new to Couchbase and NoSql technologies in general, but I'm working on a web chat application running on node js using express and some other modules. I've chosen to work with NoSql to store sessions and all needed data on server-side. But I don't really understand some important features...

Couchbase - When should i use N1QL vs Views?

couchbase,couchbase-view,n1ql
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 City A Route doc holds...

Is Couchbase an ordered key-value store?

database,couchbase,key-value-store,couchbase-lite
Are documents in Couchbase stored in key order? In other words, would they allow efficient queries for retrieving all documents with keys falling in a certain range? In particular I need to know if this is true for Couchbase lite.

Cannot create user in Couchbase Sync Gateway

rest,couchbase,couchbase-sync-gateway
I have a running instance of a sync gateway which is connected with a data bucket. I configured the gateway with an initial user: "firstuser": { "disabled": false, "password": "abc" } The sync gateway webview shows exactly this single user. Now I want to add another user via the REST...

custom global function, used in Couchbase views

javascript,couchbase
I have a JavaScript library which I want to use from map functions in Couchbase views. Is there a way to install this library in some "global" way, so it will be available from all view definitions I create?

Couchbase Document ID Requirements and limitations

couchbase,couchbase-lite
What are the restrictions for a Couchabse Document's ID string? Length? Are special characters allowed? What does the string have to start and end with? Couchbase Guide Sample Code: var properties = new Dictionary<string, object> { {"title", "Little, Big"}, {"author", "John Crowley"}, {"published", 1982} }; var document = database.GetDocument("978-0061120053"); Debug.Assert(document...

How to order results from CouchbaseViewQuery on Couchbase PHP SDK 2.0?

php,couchbase,couchbase-view
I started studying both Couchbase and MongoDB to decide wich one to implement on a social network, but the lack of documentation on couchbase side is almost making me give up. Almost everything I must guess, as documentation are poor, and easier to get confuse between PHP SDK 2.0 and...

SAILS-CBES adapter key, what is it?

sails.js,couchbase
I had issues correctly configuring my couchbase adapter in sails-js. I am using the sails-cbes adapter. The documentation fails to mention the key to use. For any who might struggle as I did, below is my configuration file: { ... //couchbase cb: { adapter: 'sails-cbes', host: 'localhost', port: 8091, user:...

Filter array field in couchbase

android,view,filter,mapreduce,couchbase
I m working on couchbase lite android. I have series of documents, every document contains a field which it's value is array of string. now I want to filter value of this field. { type : "customer", name: "customerX", states: [ "IL" , "IO" , "NY" , "CA" ] },...

Elastic Search-Search string having spaces and special characters in it using C#

c#-4.0,elasticsearch,couchbase,nest
I am looking for ElasticSearch nest query which will provide exact match on string having spaces in it using C#. for example - I want to search for a word like 'XYZ Company Solutions'. I tried querystring query but it gives me all the records irrespective of search result. Also...

How to write a view in couchbase for this sql statement

couchbase,couchbase-view
Let's say I have the following documents Document 1 { companyId: "1", salesDate: "1425254400000" //this is UTC time as a long } Document 2 { companyId: "1", salesDate: "1425340800000" //this is UTC time as a long } Document 3 { companyId: "2", salesDate: "1425254400000" //this is UTC time as a...

Couchbase - Large documents or lots of smaller ones?

couchbase
I am building an application which allows users to post content. This content can then be commented on. Assume the following: A document for the content is between 200KB and 3MB inside depending on the text content. Each comment is between 10KB and 100KB in size. There could be 1...

Fatal Error: “key does not exist on the server”

php,couchbase
Why does couchbase client for php throw a fatal error Fatal error: Uncaught exception 'CouchbaseException' with message 'The key does not exist on the server' in [CouchbaseNative]/CouchbaseBucket.class.php on line 196 Moreover there is no provision to check whether a key exists on the couchbase or not. I am writing a...

Add name attribute to what gets emitted from a view in couchbase

couchbase,couchbase-view
I have a really simple emit statement in a view. emit([doc.salesDate, doc.companyId], doc.grossSales); Is there any way I can make the JSON object it returns show up like this { "grossSales" : "100" } instead of { 0: "100" } EDIT: I'm using the rest API if it makes a...

Failing to load byte[] or base64 data in Couchbase using C# client

c#,.net,couchbase,nancy,system.net.sockets
When trying to in/upsert a document using either byte[] or a base64 encoded string I'm getting an exception and a !result.Success Message = "Specified argument was out of the range of valid values.\r\nParameter name: count My document doesn't contain anything named count. This exception all carries an inner exception of...

How to track query execution time in N1QL of couchbase server?

couchbase,n1ql
Is there any easy way to get query time in couchbase server's N1QL like .explain() in mongodb? I have a query like SELECT c.name, c.description from customer c and I would like to trace the time. ...

Cannot assign to the result of this expression when assigning values to a NSDictionary

ios,swift,couchbase
I am trying to implement the code found here : http://developer.couchbase.com/mobile/develop/guides/couchbase-lite/native-api/document/index.html#updating , at the .update method, in the following code : document = database.documentWithID(u.id) document.update({ (newRev) -> Bool in newRev["a"] = "A" return true }, error: &error) But swift is not letting me add the value into the newRev variable,...

Connecting to Couchbase Server Cluster

node.js,couchbase
I've been using Couchbase for my database solution and so far it looks very good. I'm confused however with connecting to a Cluster. A Cluster is just a group of nodes so when you use the API to connect to a Cluster what do you use as the IP? Do...

How to remove default mapping of index without deleting its data of elasticsearch

c#-4.0,elasticsearch,couchbase,nest
I have some documents in Couch-base in which some field values are having space in it ("Ex. "New York"). I am not able to search it as exact match using term query. I found that for searching the field values which are have space require some mapping like - index...