클래스: Mongoid::Contextual::MapReduce
- 상속:
-
객체
- 객체
- Mongoid::Contextual::MapReduce
- 확장자:
- 전달 가능
- 다음을 포함합니다.
- 열거형, 명령
- 다음에 정의됨:
- lib/mongoid/contextual/map_reduce.rb
개요
mapReduce 데이터베이스 명령 지침을 나타냅니다.
인스턴스 속성 요약
명령에 포함된 속성
# 컬렉션, # 컬렉션 쿼리 할 컬렉션 입니다., #criteria, #criteria 컨텍스트에 대한 기준입니다.
인스턴스 메서드 요약 접기
-
#명령 ⇒ 해시
명령 사양의 선택기를 반환합니다.
-
#counts ⇒ 해시
맵/리듀스에서 반환된 모든 카운트를 가져옵니다.
-
#각각(&block) ⇒ 열거자
데이터베이스에서 다시 전달된 추가 정보를 제외하고 맵/리듀스의 각 문서를 반복합니다.
-
#방출된 ⇒ 정수
맵/리듀스에서 내보낸 문서 수를 가져옵니다.
-
#finalize(function) ⇒ MapReduce
맵/리듀스에 대한 finalize JavaScript 함수를 제공합니다.
-
#initialize(collection, criteria, map, reduce) ⇒ MapReduce
생성자
새 맵/리듀스 지시문을 초기화합니다.
-
#입력 ⇒ 정수
맵/리듀스에 입력된 문서 수를 가져옵니다.
-
#검사 ⇒ string
기준, 맵, 리듀스, 파이널라이즈 및 출력 옵션을 포함하여 맵/리듀스의 예쁜 string 표현을 가져옵니다.
-
#js_mode ⇒ MapReduce
jsMode를 사용하도록 맵/리듀스를 설정합니다.
-
#out(위치) ⇒ MapReduce
맵/리듀스 출력을 저장할 위치를 지정합니다.
-
#output ⇒ Integer
맵/리듀스로 출력된 문서 수를 가져옵니다.
-
#원시 ⇒ 해시 (동의어: #results, #execute)
맵/리듀스 작업에서 원시 출력을 가져옵니다.
-
#reduced ⇒ 정수
맵/리듀스로 감소된 문서 수를 가져옵니다.
-
#범위(객체) ⇒ MapReduce
맵/리듀스의 전역 범위에 JavaScript 객체 를 추가합니다.
-
#time ⇒ Float
맵/리듀스의 실행 시간을 가져옵니다.
Command에 포함된 메서드
생성자 세부 정보
#initialize(컬렉션, criteria, map, reduce) ⇒ MapReduce
새 맵/리듀스 지시문을 초기화합니다.
73 74 75 76 77 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 73 def 초기화(컬렉션, 기준, map, reduce) @collection = 컬렉션 @criteria = 기준 @map_reduce = @criteria.보기.map_reduce(map, reduce) end |
인스턴스 메서드 세부 정보
#명령 ⇒ 해시
명령 사양의 선택기를 반환합니다.
217 218 219 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 217 def 명령 @map_reduce.send(:map_reduce_spec)[:selector] end |
#counts ⇒ 해시
맵/리듀스에서 반환된 모든 카운트를 가져옵니다.
20 21 22 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 20 def 카운트 결과['counts'] end |
#각각(&block) ⇒ 열거자
데이터베이스에서 다시 전달된 추가 정보를 제외하고 맵/리듀스의 각 문서를 반복합니다.
33 34 35 36 37 38 39 40 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 33 def 각(&차단) validate_out! 만약 block_given? @map_reduce.각(&차단) other @map_reduce.to_enum end end |
#방출된 ⇒ 정수
맵/리듀스에서 내보낸 문서 수를 가져옵니다.
48 49 50 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 48 def 방출 카운트['emit'] end |
#finalize(function) ⇒ MapReduce
맵/리듀스에 대한 finalize JavaScript 함수를 제공합니다.
60 61 62 63 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 60 def 마무리(함수) @map_reduce = @map_reduce.마무리(함수) self end |
#input ⇒ Integer
맵/리듀스에 입력된 문서 수를 가져옵니다.
85 86 87 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 85 def 입력 카운트['input'] end |
#검사 ⇒ string
기준, 맵, 리듀스, 파이널라이즈 및 출력 옵션을 포함하여 맵/리듀스의 예쁜 string 표현을 가져옵니다.
203 204 205 206 207 208 209 210 211 212 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 203 def 검사 %(#<Mongoid::Contextual::MapReduce 선택기: #{기준. 선택기.검사} 클래스:#{기준. klass} 맵: #{명령 [:맵]} 축소:#{command[:reduce]}finalize: #{command[:finalize]} out: #{command[:out]. 검사}> ) end |
#js_mode ⇒ MapReduce
jsMode를 사용하도록 맵/리듀스를 설정합니다.
95 96 97 98 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 95 def js_mode @map_reduce = @map_reduce.js_mode(true) self end |
#out(위치) ⇒ MapReduce
맵/리듀스 출력을 저장할 위치를 지정합니다. 지원되는 맵 축소 옵션은 MongoDB 설명서를 참조하세요.
121 122 123 124 125 126 127 128 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 121 def out(위치) 정규화 = 위치.dup 정규화.transform_values! do |value| value.is_a?(::기호) ? value.to_s : value end @map_reduce = @map_reduce.out(정규화) self end |
#output ⇒ Integer
맵/리듀스로 출력된 문서 수를 가져옵니다.
136 137 138 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 136 def 출력 카운트['output'] end |
#raw ⇒ 해시 ~라고도 함: 결과, 실행
맵/리듀스 작업에서 원시 출력을 가져옵니다.
146 147 148 149 150 151 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 146 def 원시 validate_out! cmd = 명령 opts = { 읽기: 기준..가져오기(:read) } 만약 기준.[:read] @map_reduce.database.명령(cmd, (opts || {}).merge(세션: _session)).first end |
#reduced ⇒ 정수
맵/리듀스로 감소된 문서 수를 가져옵니다.
169 170 171 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 169 def 감소 카운트['reduce '] end |
#범위(객체) ⇒ 맵 리듀스
맵/리듀스의 전역 범위에 JavaScript 객체 를 추가합니다.
181 182 183 184 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 181 def 범위(객체) @map_reduce = @map_reduce.범위(객체) self end |
#time ⇒ Float
맵/리듀스의 실행 시간을 가져옵니다.
192 193 194 |
# 파일 'lib/mongoid/contextual/map_reduce.rb', 줄 192 def 시간 결과['timeMillis'] end |