public class CollectionSpec extends Object
CollectionSpec
describes properties of a collection that can be managed.Modifier and Type | Field and Description |
---|---|
static Duration |
NEVER_EXPIRE
A special collection "max expiry" value that means documents in the collection
never expire, regardless of the bucket's max expiry setting.
|
static Duration |
SAME_EXPIRY_AS_BUCKET
A special collection "max expiry" value that means the collection's
max expiry is always the same as the bucket's max expiry.
|
Modifier and Type | Method and Description |
---|---|
static CollectionSpec |
create(String name)
Creates a new
CollectionSpec using the default scope. |
static CollectionSpec |
create(String name,
Duration maxExpiry)
Creates a new
CollectionSpec with a custom max expiry on the default scope. |
static CollectionSpec |
create(String name,
String scopeName)
Creates a new
CollectionSpec with default properties. |
static CollectionSpec |
create(String name,
String scopeName,
Duration maxExpiry)
Creates a new
CollectionSpec with a custom max expiry. |
boolean |
equals(Object o) |
int |
hashCode() |
Boolean |
history()
whether history retention is enabled on this collection.
|
protected static CollectionSpec |
internalCreate(String name,
String scopeName,
Duration maxExpiry,
Boolean history)
Creates a new
CollectionSpec with a custom max expiry. |
Duration |
maxExpiry()
The max expiry for documents in this collection,
or a non-positive duration indicating special expiry behavior.
|
String |
name()
The name of the collection.
|
String |
scopeName()
The name of the parent scope.
|
String |
toString() |
@Stability.Volatile public static final Duration SAME_EXPIRY_AS_BUCKET
Use the bucket management API to discover the actual expiry value.
@SinceCouchbase(value="7.6") @Stability.Volatile public static final Duration NEVER_EXPIRE
Requires Couchbase Server 7.6 or later.
public static CollectionSpec create(String name)
CollectionSpec
using the default scope.name
- the name of the collection.CollectionSpec
.public static CollectionSpec create(String name, String scopeName)
CollectionSpec
with default properties.name
- the name of the collection.scopeName
- the name of the parent scope.CollectionSpec
.@Stability.Volatile public static CollectionSpec create(String name, Duration maxExpiry)
CollectionSpec
with a custom max expiry on the default scope.name
- the name of the collection.maxExpiry
- the maximum expiry (ttl) to use for this collection.CollectionSpec
.@Stability.Volatile public static CollectionSpec create(String name, String scopeName, Duration maxExpiry)
CollectionSpec
with a custom max expiry.name
- the name of the collection.scopeName
- the name of the parent scope.maxExpiry
- the maximum expiry (ttl) to use for this collection.CollectionSpec
.@Stability.Volatile @Stability.Internal protected static CollectionSpec internalCreate(String name, String scopeName, Duration maxExpiry, Boolean history)
CollectionSpec
with a custom max expiry.name
- the name of the collection.scopeName
- the name of the parent scope.maxExpiry
- the maximum expiry (ttl) to use for this collection.history
- whether history retention is enabled on this collection.CollectionSpec
.public String name()
public String scopeName()
@Stability.Volatile public Duration maxExpiry()
SAME_EXPIRY_AS_BUCKET
,
NEVER_EXPIRE
@Stability.Volatile public Boolean history()
Copyright © 2024 Couchbase, Inc.. All rights reserved.