couchbase

Couchbase update for multiple set

ぃ、小莉子 提交于 2019-12-23 17:19:38
问题 I have the following n1ql query: UPDATE default USE KEYS '557a7628-1217-4974-95cf-d64247c560cd' SET p.last_seen_message_id = 'e5010536-7fde-42c1-9fea-e4a29e560f53', p.last_seen_message_text = 'hello' FOR p IN participants WHEN p.id = '119c35ab-a1cc-4e9f-bab5-d58d6d396623' END WHERE doc_type = 'conversation' RETURNING default.* With this query, I would like to set two properties in an array's element, but only the last one ( p.last_seen_message_text = 'hello' ) has any effect. The first (in

Multiple insert Couchbase with node.js

江枫思渺然 提交于 2019-12-23 16:06:12
问题 I'm trying to insert multiple records into couchbase, just now, I'm using the official node-couchbase driver. var db = new couchbase.Connection({host: hostname, bucket: myBucket, password: pass}, function(error){ console.log(error); }); var g = guid.raw() var a = []; for(var i=0; i<100; i++){ new_beer = { "iteration" : i, "category": "North American Ale" } a.push(new_beer); } console.log(guid); db.set(g, a, function(err, result) { console.log(err); }); Just in the insertion, only insert 1

Couchbase N1QL queries on server

旧街凉风 提交于 2019-12-23 15:53:48
问题 I used the online N1QL tutorial to practices writing queries. Now that I have a couchbase server of my own, I want to query my own data. My questions is Where in the Couchbase server can I write my queries? thanks 回答1: Remember that N1Q1 is still in Beta. The way it works is that you have to run Couchbase Query Server (aka CBQ). It runs in a default port 8093 (see N1QL) The query server will connect to the specified Couchbase instance/cluster. e.g. cbq-engine -couchbase <CB-location> Once CB

How to get all documents from the data bucket using c#?

蓝咒 提交于 2019-12-23 15:52:42
问题 How can I get all the documents from the data bucket? I have tried a sample but I'm able to get only a specific document. Here is my code: CouchbaseClient oclient; oclient= new CouchbaseClient("vwspace", "");// data bucket name var results = oclient.Get("205");// document id How to get all the documents? var results = oclient.? //what should i use here to get all documents 回答1: Using Couchbase Server 2.0, you would use a view to get all documents. Your view would look like: function (doc,

Overriden method still gets called

旧城冷巷雨未停 提交于 2019-12-23 15:37:42
问题 I am using a library that is implementing a belongs_to association between two entries in a database. Since this is not the behaviour I need I want to override this method via prepend . But pry tells me that the original method is still called. I double checked and I'm using ruby 2.0. The code that gets prepended: module Associations module ClassMethods [...] #Add the attributeName to the belongsToAttributes #and add a field in the list for the IDs def belongs_to(attr_name)

Trouble configuring/building couchnode on ubuntu

一世执手 提交于 2019-12-23 10:06:45
问题 I have installed both nodejs, and the module couchbase via npm. couchbase is installed too, and I can access to the backend via the browser. The same server.js file does work on windows. I have installed python 2.7. am I missing something? Im getting the Error: marcel@servermarcel:~/game$ nodejs server.js /home/marcel/game/node_modules/couchbase/lib/binding.js:156 throw new Error('Failed to locate couchnode native binding' + ^ Error: Failed to locate couchnode native binding (maybe check

Filter documents using n1ql

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 02:38:12
问题 I have two types of documents with a relation one to many and I need to get only one document basing on the latest date value. Here it is an example: Document Type (Singer): { "id":"223-34fd-35325-dsf-343f", "resourceType":"Singer", "name":"Paul" } Document Type (Album1): { "id":"456-d435-43g346-43-436tf-345g", "name":"Amazing night", "author":"223-34fd-35325-dsf-343f", "creationDate": "2017-05-12T07:57:51.458Z" } Document Type (Album2): { "id":"878-ffe6-43gs56-5hn7-ffgdd-345hd", "name":"Be

Couchbase PHP SDK: How to detect couchbase connection failure?

吃可爱长大的小学妹 提交于 2019-12-22 18:08:17
问题 I am using Couchbase PHP Extension to connect to Couchbase and implementing a feature that can detect if Couchbase is not responding and failover to MySQL. However, I can't figure out how to detect if Couchbase is down, I cannot find anything in their documentation for that. Following is the code I have: $cb = new Couchbase("$host:$port", $admin, $password, $bucket); if (!$cb) { throw Exception('Cannot connect to couchbase!'); } Any help will be much appreciated. 回答1: I run into the same

Delete entry in couchbase bucket using key in the form of regex

北城以北 提交于 2019-12-21 05:30:53
问题 I have a requirement wherein I have to delete an entry from the couchbase bucket. I use the delete method of the CouchbaseCient from my java application to which I pass the key. But in one particular case I dont have the entire key name but a part of it. So I thought that there would be a method that takes a matcher but I could not find one. Following is the actual key that is stored in the bucket 123_xyz_havefun and the part of the key that I have is xyz. I am not sure whether this can be

Proposed solution: Generate unique IDs in a distributed environment

偶尔善良 提交于 2019-12-20 09:39:49
问题 I've been browsing the net trying to find a solution that will allow us to generate unique IDs in a regionally distributed environment. I looked at the following options (among others): SNOWFLAKE (by Twitter) It seems like a great solutions, but I just don't like the added complexity of having to manage another software just to create IDs; It lacks documentation at this stage, so I don't think it will be a good investment; The nodes need to be able to communicate to one another using