<commit_before>package pl.softwaremill.bootstrap.dao

import pl.softwaremill.bootstrap.domain.Entry
import com.mongodb.casbah.Imports._
import com.mongodb.casbah.MongoDB
import com.novus.salat.dao.SalatDAO
import com.mongodb.casbah.commons.MongoDBObject
import com.novus.salat.global._

class EntryDAO(implicit mongoConn: MongoDB) extends SalatDAO[Entry, ObjectId](mongoConn("entries")) {

  def loadAll = {
    find(MongoDBObject()).toList
  }

  def count(): Long = {
    super.count()
  }

  def add(entry: Entry) {
    insert(entry, WriteConcern.Safe)
  }

  def remove(entryId: String) {
    remove(MongoDBObject("_id" -> new ObjectId(entryId)))
  }
<commit_msg>Entries now are ordered from latest<commit_after>package pl.softwaremill.bootstrap.dao

import pl.softwaremill.bootstrap.domain.Entry
import com.mongodb.casbah.Imports._
import com.mongodb.casbah.MongoDB
import com.novus.salat.dao.SalatDAO
import com.mongodb.casbah.commons.MongoDBObject
import com.novus.salat.global._

class EntryDAO(implicit mongoConn: MongoDB) extends SalatDAO[Entry, ObjectId](mongoConn("entries")) {

  def loadAll = {
    find(MongoDBObject()).sort(MongoDBObject("_id" -> -1)).toList
  }

  def count(): Long = {
    super.count()
  }

  def add(entry: Entry) {
    insert(entry, WriteConcern.Safe)
  }

  def remove(entryId: String) {
    remove(MongoDBObject("_id" -> new ObjectId(entryId)))
  }

{'fraction_non_alphanumeric': 0.12670986321094313, 'fraction_numerical': 0.0007199424046076314, 'mean_word_length': 4.582329317269076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1696146', 'n_tokens_mistral': 512, 'n_tokens_neox': 493, 'n_words': 84}