m16
v1.1.0
Published
Mongodb ODM for TypeScript.
Downloads
10
Readme
Mongodb ODM for TypeScript.
import { Document, document, connect, prop } from 'm-16';
connect('mongodb://localhost:27017/test');
@document()
export class Dog extends Document {
@prop() name: string;
}
const dog = new Dog({name:'Pluto'});
await dog.save();
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});
const Cat = mongoose.model('Cat', { name: String });
const kitty = new Cat({ name: 'Zildjian' });
kitty.save().then(() => console.log('meow'));