模块:Mongoid::Indexable::Validators::Options

扩展方式:
选项
包含在:
选项
定义于:
lib/mongoid/indexable/validators/options.rb

Overview

验证传递给索引宏的选项。

常量摘要折叠

VALID_OPTIONS =
[
  :背景,
  :database,
  :default_ language,
  : language_override,
  :name,
  :sparse,
  :unique,
  :max,
  :min,
  :bits,
  :bucket_size,
  :expire_after_seconds,
  :weights,
  :storage_engine,
  :key,
  :sphere_version,
  :text_version,
  :version,
  :partial_filter_expression,
  :collation,
  :wildcard_projection,
]
VALID_TYPES =
[
  1,
  -1,
  " 2 d ",
  " 2 dsphere ",
  " geoHaystack ",
  " text ",
  " 哈希 "
]

实例方法摘要折叠

实例方法详细信息

# validate (klass, spec, options) ⇒对象

验证索引规范。

例子:

验证索引规范。

Options.validate(Band, name: 1)

参数:

  • klass ( class )

    模型类。

  • spec (哈希)

    索引规范。

  • 选项 (哈希)

    索引选项。

引发:

[查看源代码]

56
57
58
59
# File 'lib/mongoid/indexable/validators/options.rb', line 56

def 验证(klass, spec, 选项)
  validate_spec(klass, spec, 选项)
  validate_options(klass, spec, 选项)
end