1 | # LSK.js – db
|
2 |
|
3 | > @lskjs/db – LSK.js module for working with mongodb database
|
4 |
|
5 | [![LSK logo](https://badgen.net/badge/icon/MADE%20BY%20LSK?icon=zeit\&label\&color=red\&labelColor=red)](https://github.com/lskjs)
|
6 | [![NPM version](https://badgen.net/npm/v/@lskjs/db)](https://www.npmjs.com/package/@lskjs/db)
|
7 | [![NPM downloads](https://badgen.net/npm/dt/@lskjs/db)](https://www.npmjs.com/package/@lskjs/db)
|
8 | [![NPM Dependency count](https://badgen.net/bundlephobia/dependency-count/@lskjs/db)](https://bundlephobia.com/result?p=@lskjs/db)
|
9 | [![Have TypeScript types](https://badgen.net/npm/types/@lskjs/db)](https://www.npmjs.com/package/@lskjs/db)
|
10 | [![Have tree shaking](https://badgen.net/bundlephobia/tree-shaking/@lskjs/db)](https://bundlephobia.com/result?p=@lskjs/db)
|
11 | [![NPM Package size](https://badgen.net/bundlephobia/minzip/@lskjs/db)](https://bundlephobia.com/result?p=@lskjs/db)
|
12 | [![Package size](https://badgen.net//github/license/lskjs/lskjs)](https://github.com/lskjs/lskjs/blob/master/LICENSE)
|
13 | [![Ask us in Telegram](https://img.shields.io/badge/Ask%20us%20in-Telegram-brightblue.svg)](https://t.me/lskjschat)
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | ***
|
20 |
|
21 |
|
22 |
|
23 | # Table of contents
|
24 |
|
25 | * [⌨️ Install](#️-install)
|
26 | * [Example of exntend](#example-of-exntend)
|
27 | * [📖 License](#-license)
|
28 | * [👥 Contributors](#-contributors)
|
29 | * [👏 Contributing](#-contributing)
|
30 | * [📮 Any questions? Always welcome :)](#-any-questions-always-welcome-)
|
31 |
|
32 | # ⌨️ Install
|
33 |
|
34 | ```sh
|
35 | # yarn
|
36 | yarn i @lskjs/db @types/mongoose bluebird lodash
|
37 |
|
38 | # npm
|
39 | npm i @lskjs/db @types/mongoose bluebird lodash
|
40 | ```
|
41 |
|
42 | ***
|
43 |
|
44 | основная фишка - UniversalSchema
|
45 |
|
46 | # Example of exntend
|
47 |
|
48 | ```
|
49 | import BotsTelegramMessageModel from '@lskjs/bots/models/BotsTelegramMessageModel'
|
50 |
|
51 | export default (...args) => {
|
52 | const Schema = BotsTelegramMessageModel(...args);
|
53 | Schema.extend({
|
54 | status: {
|
55 | type: String,
|
56 | }
|
57 | });
|
58 | return Schema;
|
59 | };
|
60 |
|
61 |
|
62 | export default (...args) => {
|
63 | const Schema = BotsTelegramMessageModel(...args);
|
64 | Schema.schema = {
|
65 | ...Schema.schema,
|
66 | status: {
|
67 | type: String,
|
68 | }
|
69 | }
|
70 | return Schema;
|
71 | };
|
72 |
|
73 | ```
|
74 |
|
75 | # 📖 License
|
76 |
|
77 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
|
78 |
|
79 | # 👥 Contributors
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | <table>
|
88 | <tr>
|
89 | <td align="center"><a href="https://isuvorov.com"><img src="https://avatars2.githubusercontent.com/u/1056977?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Igor Suvorov</b></sub></a><br /><a href="lskjs/lskjs///commits?author=isuvorov" title="Code">💻</a> <a href="#design-isuvorov" title="Design">🎨</a> <a href="#ideas-isuvorov" title="Ideas, Planning, & Feedback">🤔</a></td>
|
90 | </tr>
|
91 | </table>
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | # 👏 Contributing
|
97 |
|
98 | 1. Fork it (<https://github.com/yourname/yourproject/fork>)
|
99 | 2. Create your feature branch (`git checkout -b features/fooBar`)
|
100 | 3. Commit your changes (`git commit -am 'feat(image): Add some fooBar'`)
|
101 | 4. Push to the branch (`git push origin feature/fooBar`)
|
102 | 5. Create a new Pull Request
|
103 |
|
104 | # 📮 Any questions? Always welcome :)
|
105 |
|
106 | * [Email](mailto:hi@isuvorov.com)
|
107 | * [LSK.news – Telegram channel](https://t.me/lskjs)
|
108 | * [Спроси нас в телеграме ;)](https://t.me/lskjschat)
|