spring-data-couchbase

How to set couchbase operation timeout in spring data couchbase?

前提是你 提交于 2019-12-10 15:59:19
问题 I have a simple spring project which try to retrieve a document from couchbase using spring-data-couchbase. I have configured the config by extending AbstractCouchbaseConfiguration. Everything works perfectly fine. Since I use couchbase as a cache, now I need to set the operation timeout to a lower value. Anybody can shed some light on how to do it? 回答1: To define a timeout for the CouchbaseClient you have to provide it using the ConnectionFactory. Sadly, the current version of spring-data

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

拈花ヽ惹草 提交于 2019-12-06 05:23:34
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. If you look at existing beer samples in Couchbase (it comes with it), you will find views defined there. In admin console you can run a view. Notice when you run a view you can provide filtering criteria and sort order for the result...that might be an equivalent for your SQL like functionality. Read more on Views and Indexes yet another option is to

Use Spring Data Couchbase to connect to different Couchbase clusters

可紊 提交于 2019-12-06 01:14:58
I'm looking for a way to use Spring Data Couchbase to connect to two separate Couchbase clusters. Looking at the documentation and the implementation, it is not clear as how to do this and my concern is that there will be bean name conflicts if have two configurations that extend AbstractCouchbaseConfiguration . The only thing that looks close is to use the RepositoryOperationsMapping to specify different templates for different repositories. This however doesn't suit my needs as each of the Couchbase configurations will not be aware of the other. The only means i see of doing this now is to

How to fetch a field from document using n1ql with spring-data-couchbase

丶灬走出姿态 提交于 2019-12-02 07:27:21
This is the query in the repository which works fine. public interface PlayerRepo extends CrudRepository<Player, String>{ @Query("#{#n1ql.selectEntity} WHERE code = $1 and #{#n1ql.filter}") public List<Player> findPlayersWithCode(String code); } I want to fetch specific field from Player document, like this: @Query("#{#n1ql.selectEntity.name} WHERE code = $1 and #{#n1ql.filter}") public List<String> findPlayerNamesWithCode(String code); Is it possible to do this, I am using spring-data-couchbase 2.1.2 Currently, this is not possible from a repository. Spring Data Hopper introduced a Projection

How to set TTL for a specific Couchbase document using spring-data-couchbase?

浪子不回头ぞ 提交于 2019-12-01 00:51:22
How to set TTL (Time to Live) for a specific couchbase document using spring-data-couchbase? I know there is way to set expiry time using Document notation as follows @Document(expiry = 10) http://docs.spring.io/spring-data/couchbase/docs/1.1.1.RELEASE/reference/html/couchbase.entity.html It will set TTL for all the documents save through the Entity class. But it seems there is way to set expiration(TTL) time for a specific document "Get and touch: Fetch a specified document and update the document expiration." mentioned in http://docs.couchbase.com/developer/dev-guide-3.0/read-write.html How

How to set TTL for a specific Couchbase document using spring-data-couchbase?

荒凉一梦 提交于 2019-11-30 18:24:58
问题 How to set TTL (Time to Live) for a specific couchbase document using spring-data-couchbase? I know there is way to set expiry time using Document notation as follows @Document(expiry = 10) http://docs.spring.io/spring-data/couchbase/docs/1.1.1.RELEASE/reference/html/couchbase.entity.html It will set TTL for all the documents save through the Entity class. But it seems there is way to set expiration(TTL) time for a specific document "Get and touch: Fetch a specified document and update the

How to use spring data with couchbase without _class attribute

南楼画角 提交于 2019-11-30 15:23:07
Is there a simple way to use spring data couchbase with documents that do not have _class attribute? In the couchbase I have something like this in my sampledata bucket: { "username" : "alice", "created" : 1473292800000, "data" : { "a": 1, "b" : "2"}, "type" : "mydata" } Now, is there any way to define mapping from this structure of document to Java object (note that _class attribute is missing and cannot be added) and vice versa so that I get all (or most) automagical features from spring couchbase data? Something like: If type field has value "mydata" use class MyData.java. So when find is

No mapping metadata found for java.lang.Object - Couchbase

爷,独闯天下 提交于 2019-11-28 14:40:42
I'm persisting an entity in a CouchBase repository and trying to query it. The entity looks like this: @Document(expiry = 0) public class GsJsonStore implements Serializable { private static final long serialVersionUID = 7133072282172062535L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; @Field private Map<String,Object> _object; @Field private String _subject; @Field private String _predicate; //Getters and Setters } I'm querying the entity by using N1QL queries on the CouchbaseOperations template like this: String query1 = "SELECT META(default).id as _ID, META(default)

No mapping metadata found for java.lang.Object - Couchbase

≡放荡痞女 提交于 2019-11-27 08:51:26
问题 I'm persisting an entity in a CouchBase repository and trying to query it. The entity looks like this: @Document(expiry = 0) public class GsJsonStore implements Serializable { private static final long serialVersionUID = 7133072282172062535L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; @Field private Map<String,Object> _object; @Field private String _subject; @Field private String _predicate; //Getters and Setters } I'm querying the entity by using N1QL queries on the