UNPKG

quaerateum

Version:

Simple typescript ORM for node.js based on data-mapper, unit-of-work and identity-map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JS.

24 lines (16 loc) 481 B
import { ObjectID } from 'mongodb'; import { Collection, Entity, ManyToMany, PrimaryKey, Property, IEntity } from '../../lib'; import { Book } from './Book'; @Entity() export class BookTag { @PrimaryKey() _id: ObjectID; @Property() name: string; @ManyToMany({ entity: () => Book.name, mappedBy: 'tags' }) books: Collection<Book> = new Collection<Book>(this); constructor(name: string) { this.name = name; } } export interface BookTag extends IEntity { }