Method: Mongo::SearchIndex::View#each
- Defined in:
- lib/mongo/search_index/view.rb
#each(&block) ⇒ self | Enumerator
Iterate over the search indexes.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/mongo/search_index/view.rb', line 111 def each(&block) @result ||= begin spec = {}.tap do |s| s[:id] = requested_index_id if requested_index_id s[:name] = requested_index_name if requested_index_name end collection.with(read_concern: {}).aggregate( [ { '$listSearchIndexes' => spec } ], ) end return @result.to_enum unless block @result.each(&block) self end |