クラス: Mongo::Collection::View::Builder::Aggregation

継承:
オブジェクト
  • オブジェクト
すべて表示
次による拡張機能。
転送可能
定義:
lib/mongo/ コレクション/view/Builder/ 集計.rb

Overview

ビューとオプションから集計コマンド仕様を構築します。

以来

  • 2.2.0

定数の概要の削減

マッピング =

Ruby オプションから集計オプションへのマッピング。

以来

  • 2.2.0

BSON::ドキュメント.新着情報(
  allow_disk_use: 'allowDiskUse',
  bypass_document_validation: 'bypassDocumentValidation',
  explain: ' explain ',
  collation: 照合,
  comment: 'comment',
  hint: 'hint',
  let: ' let ',
  # これは意図的です。 max_await_time_ms は maxTimeMS のエイリアスです
  変更ストリームの getMore コマンド で使用される数。
  max_await_time_ms: 'maxTimeMS',
  max_time_ms: 'maxTimeMS',
).freeze

インスタンス属性の概要を折りたたむ

インスタンス メソッドの概要を折りたたむ

コンストラクターの詳細

#初期化(パイプライン、ビュー、オプション) =集計

ビルダを初期化します。

パラメーター:

  • パイプライン <Hash>配列 )

    集計パイプライン。

  • 表示 コレクション::View

    コレクションビュー。

  • options ハッシュ

    map/reduce と読み込み設定(read preference)のオプション。

以来

  • 2.2.0



64
65
66
67
68
# ファイル 'lib/mongo/ コレクション/view/Builder/ 集計.rb' は、64 行を

デフォルト 初期化(パイプライン, 表示, options)
  @ pipeline = パイプライン
  @view = 表示
  @options = options
end

インスタンス属性の詳細

オプション=ハッシュ(読み取り専用)

特定のオプションのmap/reduce オプションを返します。

次の値を返します。

  • ハッシュ

    options の具体的なオプションを map/reduce します。

以来

  • 2.2.0



55
56
57
# ファイル 'lib/mongo/ コレクション/view/Builder/ 集計.rb' は、55 行を

デフォルト options
  @options
end

#パイプライン= Array<Hash> (読み取り専用)

パイプライン パイプラインを返します。

次の値を返します。

  • <Hash>配列 )

    パイプライン パイプライン。

以来

  • 2.2.0



49
50
51
# ファイル 'lib/mongo/ コレクション/view/Builder/ 集計.rb' は、49 行を

デフォルト パイプライン
  @ pipeline
end

# view = Collection::View (readonly)

コレクション ビューのビューを返します。

次の値を返します。

以来

  • 2.2.0



52
53
54
# ファイル 'lib/mongo/ コレクション/view/Builder/ 集計.rb' は、52 行を

デフォルト 表示
  @view
end

インスタンス メソッドの詳細

番号指定ハッシュ

集計操作に渡す仕様を取得します。

例:

仕様を取得します。

builder.specification

次の値を返します。

  • ハッシュ

    仕様。

以来

  • 2.2.0



78
79
80
81
82
83
84
85
86
87
88
89
90
# ファイル 'lib/mongo/ コレクション/view/Builder/ 集計.rb' は、78 行を

デフォルト 仕様
  スペック = {
    セレクター: aggregate_command,
    db_name: database.name,
    read: @options[:read_preference] || 表示.read_preference,
    セッション: @options[:session],
    collation: @options[:collation],
  }
  場合 書込み (write)?
    スペック.update(write_concern: write_concern)
  end
  スペック
end