Options
All
  • Public
  • Public/Protected
  • All
Menu

Logo

A really slick ORM for MongoDB.

Inspired by ActiveRecord and Eloquent, Esix is a great way to work with your database in TypeScript. 🥧

Esix uses a Convention over Configuration approach where you define your models as normal TypeScript classes and minimal boilerplate.

Getting Started

yarn add esix mongodb

Define a model.

import { BaseModel } from 'esix';

class Post extends BaseModel {
  public title = '';
  public text = '';
}

Then you can query the database for your models.

async function postsHandler(request: Request, response: Response): Promise<void> {
  const posts = await Post.all();

  response.json({ posts });
}

async function postHandler(request: Request, response: Response): Promise<void> {
  const post = await Post.find(request.params.id);

  response.json({ post });
}

You can read more about how to use Esix at the docuementation site https://esix.netlify.app/.

Index

Type aliases

Dictionary

Dictionary: {}

Type declaration

  • [index: string]: any

Document

Document: {}

Type declaration

  • [index: string]: any

Fields

Fields: {}

Type declaration

  • [index: string]: 1

ObjectType

ObjectType<T>: { constructor: any }

Type parameters

  • T

Type declaration

  • constructor: function
    • new __type(): T
    • Returns T

Order

Order: {}

Type declaration

  • [index: string]: 1 | -1

Query

Query: {}

Type declaration

  • [index: string]: any

Variables

Const connectionHandler

connectionHandler: ConnectionHandler = new ConnectionHandler()

Functions

env

  • env(key: string, defaultValue?: string): string
  • Parameters

    • key: string
    • Default value defaultValue: string = ""

    Returns string

isString

  • isString(x: any): x is string
  • Parameters

    • x: any

    Returns x is string

normalizeAttributes

normalizeName

  • normalizeName(className: string): string
  • Parameters

    • className: string

    Returns string

Legend

  • Constructor
  • Property
  • Method

Generated using TypeDoc