CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/mongoose-best-practices

Mongoose and MongoDB patterns — schema design, validation, indexes, virtuals,

99

1.11x
Quality

99%

Does it follow best practices?

Impact

100%

1.11x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-5/

{
  "context": "The agent is asked to define three Mongoose schemas for a ticketing platform: Event, Ticket, and Session. The criteria check whether the agent applies proper schema options (timestamps, required, enum, trim), uses appropriate indexes (compound, unique, TTL), and follows Mongoose schema best practices.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "timestamps on Event",
      "description": "The Event schema uses `timestamps: true` in its schema options (not manually defined createdAt/updatedAt fields)",
      "max_score": 8
    },
    {
      "name": "timestamps on Ticket",
      "description": "The Ticket schema uses `timestamps: true` in its schema options",
      "max_score": 7
    },
    {
      "name": "timestamps on Session",
      "description": "The Session schema uses `timestamps: true` in its schema options",
      "max_score": 5
    },
    {
      "name": "required fields on Event",
      "description": "The Event schema marks at least 3 core fields (e.g., title, date, venue, category, price) with `required: true`",
      "max_score": 8
    },
    {
      "name": "required fields on Ticket",
      "description": "The Ticket schema marks buyer email and event reference fields with `required: true`",
      "max_score": 7
    },
    {
      "name": "enum for ticket status",
      "description": "The Ticket schema uses an `enum` array to constrain the status field to a finite set of values",
      "max_score": 8
    },
    {
      "name": "enum for event category",
      "description": "The Event schema uses an `enum` array for the category (or genre) field",
      "max_score": 7
    },
    {
      "name": "trim on string fields",
      "description": "At least one user-facing string field (e.g., title, venue, email) includes `trim: true`",
      "max_score": 8
    },
    {
      "name": "compound index on Event",
      "description": "The Event schema defines a compound index with an equality filter field (e.g., category) first and a sort field (e.g., date) second — e.g., `{ category: 1, date: -1 }`",
      "max_score": 12
    },
    {
      "name": "unique index for email",
      "description": "A unique index is defined at the database level on the buyer email field (in Ticket) or user email field, rather than relying only on application-level uniqueness checks",
      "max_score": 10
    },
    {
      "name": "TTL index on Session",
      "description": "The Session schema defines a TTL index using `expireAfterSeconds` on the createdAt field to auto-expire sessions",
      "max_score": 12
    },
    {
      "name": "TTL value for 7 days",
      "description": "The TTL index `expireAfterSeconds` value equals 604800 (7 * 24 * 60 * 60) or an equivalent expression",
      "max_score": 8
    }
  ]
}

evals

tile.json