UNPKG

create-better-t-stack

Version:

A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations

25 lines (20 loc) 375 B
import mongoose from 'mongoose'; const { Schema, model } = mongoose; const todoSchema = new Schema({ id: { type: mongoose.Schema.Types.ObjectId, auto: true, }, text: { type: String, required: true, }, completed: { type: Boolean, default: false, }, }, { collection: 'todo' }); const Todo = model('Todo', todoSchema); export { Todo };