public class ShardKey extends Object
Immutable shard keys indicates a fixed value that is not updated (see
MongoDB
Reference: Change a Document's Shard Key Value), which allows to skip server round trips in cases where a
potential shard key change might have occurred.| Modifier and Type | Method and Description |
|---|---|
org.bson.Document |
getDocument()
Get the raw MongoDB representation of the
ShardKey. |
Collection<String> |
getPropertyNames() |
static ShardKey |
hash(String... propertyNames)
Create a new
ShardingStrategy.RANGE shard key. |
static ShardKey |
immutable(ShardKey shardKey)
|
boolean |
isImmutable() |
boolean |
isSharded()
Return whether the shard key represents a sharded key.
|
static ShardKey |
none()
ShardKey indicating no shard key has been defined. |
static ShardKey |
range(String... propertyNames)
Create a new
ShardingStrategy.RANGE shard key. |
int |
size() |
public int size()
public Collection<String> getPropertyNames()
public boolean isImmutable()
public boolean isSharded()
public org.bson.Document getDocument()
ShardKey.public static ShardKey range(String... propertyNames)
ShardingStrategy.RANGE shard key.propertyNames - must not be null.ShardKey.public static ShardKey hash(String... propertyNames)
ShardingStrategy.RANGE shard key.propertyNames - must not be null.ShardKey.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.