Sha256: 77ba668df5214613e03c2955b26f8638b6abb58521020379b04bf8680f880bc0

Contents?: true

Size: 959 Bytes

Versions: 2

Compression:

Stored size: 959 Bytes

Contents

class SmMovie
  include Mongoid::Document

  field :year, type: Integer

  index year: 1
  shard_key :year
end

class SmTrailer
  include Mongoid::Document

  index year: 1
  shard_key 'year'
end

class SmActor
  include Mongoid::Document

  # This is not a usable shard configuration for the server.
  # We just have it for unit tests.
  shard_key age: 1, 'gender' => :hashed
end

class SmAssistant
  include Mongoid::Document

  field :gender, type: String

  index gender: 1
  shard_key 'gender' => :hashed
end

class SmProducer
  include Mongoid::Document

  index age: 1, gender: 1
  shard_key({age: 1, gender: 'hashed'}, unique: true, numInitialChunks: 2)
end

class SmDirector
  include Mongoid::Document

  belongs_to :agency

  index age: 1
  shard_key :agency
end

class SmDriver
  include Mongoid::Document

  belongs_to :agency

  index age: 1, agency: 1
  shard_key age: 1, agency: :hashed
end

class SmNotSharded
  include Mongoid::Document
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-7.1.1 spec/mongoid/shardable_models.rb
mongoid-7.1.0 spec/mongoid/shardable_models.rb