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

Evaluation results

100%

16%

SaaS Analytics Platform — Database Connection Bootstrap

Criteria
Without context
With context

maxPoolSize configured

100%

100%

serverSelectionTimeoutMS set

0%

100%

socketTimeoutMS set

0%

100%

URI from environment variable

100%

100%

error event handler

100%

100%

disconnected event handler

100%

100%

SIGTERM handler

100%

100%

SIGINT handler

100%

100%

connection.close on shutdown

100%

100%

await on connect

100%

100%

100%

2%

Digital Wallet — Fund Transfer Service

Criteria
Without context
With context

startSession called

100%

100%

withTransaction used

100%

100%

session passed to debit

100%

100%

session passed to credit

100%

100%

endSession in finally

100%

100%

no independent updates

100%

100%

timestamps on Wallet schema

100%

100%

required on wallet fields

100%

100%

balanceCents minimum

100%

100%

runValidators on updates

66%

100%

100%

10%

Social Blogging Platform — Feed and Data Modeling

Criteria
Without context
With context

author data embedded

100%

100%

no populate for author

100%

100%

tags as references

100%

100%

cursor-based pagination

100%

100%

no skip usage

100%

100%

limit plus one fetch

100%

100%

nextCursor returned

100%

100%

lean on feed query

0%

100%

timestamps on Post

100%

100%

status enum on Post

100%

100%

100%

4%

E-commerce Product Catalog — Query and Update Layer

Criteria
Without context
With context

lean on listProducts

100%

100%

no lean on updateProductPrice

100%

100%

runValidators on admin update

71%

100%

save() for price update

100%

100%

no direct update for price

100%

100%

pre-save hook defined

100%

100%

enum for status

100%

100%

required fields

100%

100%

timestamps option

100%

100%

stock minimum constraint

100%

100%

new: true on admin update

100%

100%

100%

15%

Event Ticketing Platform — Schema Design

Criteria
Without context
With context

timestamps on Event

100%

100%

timestamps on Ticket

100%

100%

timestamps on Session

0%

100%

required fields on Event

100%

100%

required fields on Ticket

100%

100%

enum for ticket status

100%

100%

enum for event category

100%

100%

trim on string fields

100%

100%

compound index on Event

100%

100%

unique index for email

0%

100%

TTL index on Session

100%

100%

TTL value for 7 days

100%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents