             expandedProblems.push(expandedProblem)
         @problems = expandedProblems
         return this
-        
+
 tablesSchema.methods.descendandTables = () ->
         result = [@_id]
         for table in @table

        for problem in @problems
            result.push(problem)
        result
            
            
tablesSchema.statics.findAll = ->
    @find {}
            
tablesSchema.statics.removeDuplicateChildren = () ->
        tables = await Table.findAll()
        for table in tables

    p = parseLevel(level)
    if p.minor
        return p.major
    else
        return Table.main


tablesSchema.methods.addTable = (id) ->
    if id in @tables
        return
    @update({$push: { tables: id }})

tablesSchema.methods.setOrder = (order) ->
