mongodb.ts
v0.0.3
Published
``` git clone https://github.com/Goyoo/mongodb.ts.git npm install npm run build ```
Downloads
11
Readme
build
git clone https://github.com/Goyoo/mongodb.ts.git
npm install
npm run build
Install:
npm install typescript.ts
Usage
const Mongodb = require('mongodb.ts')
const db = Mongodb.connect('mongo_url')
interface IUser{
_id: string
username: string
password: string
created: number
}
const Users = db.collection<IUser>('users')
await Users.insert({_id: '1', name: 'moon', password: '123123', created: Date.now() })
const user = await Users.findOne({_id: '1'})
const users = await Users.find({}).limit(limit).skip(limit * page).sort({created: -1}).toArray()
await Users.remove({_id: 1})