An open API service indexing awesome lists of open source software.

https://github.com/langhuihui/mongo-search

Utils for mongodb search and display
https://github.com/langhuihui/mongo-search

Last synced: 15 days ago
JSON representation

Utils for mongodb search and display

Awesome Lists containing this project

README

        

# mongo-search
Utils for mongodb search and display

# install
npm i mongo-search

# usage

## vue component

```js
import vue from 'mongo-search/vue'
import Vue from 'vue'
Vue.use(vue)
```
```html

```
###props
```js
{
src: { type: String, required: true },
params: { type: Object },
range: { type: String, default: '' },
pageSize: { type: Number },
value: {
type: Array,
default: () => []
},
desc: {
type: Boolean,
default: true
},
search: {
type: String
}
}
```
###methods
getLast、getNext

## koa middleware

```js
const { MongoClient } = require('mongodb');
const searchM = require('mongo-search')
MongoClient.connect("mongodb://127.0.0.1:27017"), { useNewUrlParser: true }).then(x => {
let db = x.db('test')
router.get('/user',async ctx=>ctx.body=await searchM(db.collection('user')))
}
```