Class: Sorting::Student::ByName

Inherits:
Sorting::SortBy show all
Defined in:
lib/mumuki/classroom/models/sorting/student.rb

Class Method Summary collapse

Class Method Details

.order_by(ordering) ⇒ Object



11
12
13
14
# File 'lib/mumuki/classroom/models/sorting/student.rb', line 11

def self.order_by(ordering)
  {'last_name': ordering,
   'first_name': ordering}
end

.pipelineObject



4
5
6
7
8
9
# File 'lib/mumuki/classroom/models/sorting/student.rb', line 4

def self.pipeline
  [{'$addFields': {
    'last_name': {'$toLower': '$last_name'},
    'first_name': {'$toLower': '$first_name'}
  }}]
end