# Where to define computed properties row-level?

  1. define computed property as a let inside a collection in .kmongo.

    for example, to define age as a computed property:





     


    collection Employee {
    	property name:String
    	property designation:String
    	property dob:CalendarDate
    	let age:Int
    }
    
  2. run command compile

  3. implement the computation logic in the generated RowExtn class



     







    trait EmployeeRowExtn extends EmployeeRowExtnTrait {
      row: EmployeeRow =>
      override lazy val age: Int = {
        val today = grab[TimeService].todayAtLocal
        val ageInDays = dob.noOfDaysInFuture(today)
        val age = ageInDays / 365
        age
      }
    }