@Inherited @Retention(value=RUNTIME) @Target(value={TYPE,ANNOTATION_TYPE}) public @interface Sharded
Sharded
annotation provides meta information about the actual distribution of data. The
shardKey()
is used to distribute documents across shards. MongoCollection.replaceOne(org.bson.conversions.Bson, Object)
operations triggered by
save
operations on MongoOperations
and
ReactiveMongoOperations
as well as update/upsert
operations
replacing/upserting a single existing document as long as the given
UpdateDefinition
holds a full copy of the entity.
Query
parameter when invoking the method.Modifier and Type | Optional Element and Description |
---|---|
boolean |
immutableKey
As of MongoDB 4.2 it is possible to change the shard key using update.
|
ShardingStrategy |
shardingStrategy
The sharding strategy to use for distributing data across sharded clusters.
|
String[] |
shardKey
The shard key determines the distribution of the collection's documents among the cluster's shards.
|
String[] |
value
Alias for
shardKey() . |
@AliasFor(value="shardKey") public abstract String[] value
shardKey()
.shardKey()
@AliasFor(value="value") public abstract String[] shardKey
IndexOperations.ensureIndex(org.springframework.data.mongodb.core.index.IndexDefinition)
or by annotating your domain model with Indexed
/
CompoundIndex
along with enabled
auto index creation
.public abstract ShardingStrategy shardingStrategy
ShardingStrategy.RANGE
by defaultpublic abstract boolean immutableKey
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.