Sha256: a45b10ec319bf9f5437cbcf0ee54add5b9f7e671bf04cef74d11a520f29bcb08

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

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, 'hello' => :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

class SmReviewAuthor
  include Mongoid::Document
  embedded_in :review, class_name: "SmReview", touch: false
  field :name, type: String
end

class SmReview
  include Mongoid::Document

  embeds_one :author, class_name: "SmReviewAuthor"

  shard_key "author.name" => 1
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mongoid-8.0.10 spec/mongoid/shardable_models.rb
mongoid-8.1.10 spec/mongoid/shardable_models.rb
mongoid-8.1.9 spec/mongoid/shardable_models.rb
mongoid-8.0.9 spec/mongoid/shardable_models.rb
mongoid-8.1.8 spec/mongoid/shardable_models.rb
mongoid-8.1.7 spec/mongoid/shardable_models.rb
mongoid-8.1.6 spec/mongoid/shardable_models.rb
mongoid-8.0.8 spec/mongoid/shardable_models.rb
mongoid-8.1.5 spec/mongoid/shardable_models.rb
mongoid-8.1.4 spec/mongoid/shardable_models.rb
mongoid-8.0.7 spec/mongoid/shardable_models.rb
mongoid-8.1.3 spec/mongoid/shardable_models.rb
mongoid-8.1.2 spec/mongoid/shardable_models.rb
mongoid-8.0.6 spec/mongoid/shardable_models.rb
mongoid-7.5.4 spec/mongoid/shardable_models.rb
mongoid-8.1.1 spec/mongoid/shardable_models.rb
mongoid-8.0.5 spec/mongoid/shardable_models.rb
mongoid-8.1.0 spec/mongoid/shardable_models.rb
mongoid-7.5.3 spec/mongoid/shardable_models.rb
mongoid-8.0.4 spec/mongoid/shardable_models.rb