Skip to content

Commit 2573e1a

Browse files
author
Snowflake107
committed
fix docsgen
1 parent 4f854eb commit 2573e1a

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
node_modules/
2-
package-lock.json
3-
docs/
2+
package-lock.json

docs/general/welcome.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# QuickMongo
2+
Quick mongodb wrapper for beginners.
3+
4+
![QuickMongo](https://nodei.co/npm/quickmongo.png)
5+
6+
# Documentation
7+
**[QuickMongo](https://quickmongo.js.org)**
8+
9+
# Features
10+
- Beginner friendly
11+
- Easy to use
12+
- Very similar to **[quick.db](https://npmjs.com/package/quick.db)**
13+
- Dot notation support
14+
- Import & export support
15+
- Key value based
16+
- Beginner friendly
17+
- Asynchronous
18+
- Multiple model support
19+
20+
# Quick Example
21+
22+
```js
23+
const { Database } = require("quickmongo");
24+
const db = new Database("mongodb://localhost/quickmongo");
25+
26+
db.on("ready", () => {
27+
console.log("Database connected!");
28+
});
29+
30+
db.set("foo", "bar");
31+
32+
db.get("foo").then(console.log);
33+
```
34+
35+
# Importing data from quick.db
36+
37+
```js
38+
const db = require("quick.db");
39+
const { Database } = require("quickmongo");
40+
const mongo = new Database("mongodb://localhost/quickmongo");
41+
42+
function importData() {
43+
const data = db.all();
44+
mongo.import(data).then(() => {
45+
console.log("Done!");
46+
});
47+
}
48+
49+
mongo.on("ready", () => importData());
50+
```
51+
52+
# Links
53+
- **[Discord Support Server](https://discord.gg/2SUybzb)**
54+
- **[Documentation](https://quickmongo.js.org)**
55+
- **[GitHub](https://github.com/Snowflake107/quickmongo)**
56+
57+
# Example
58+
59+
```js
60+
const { Database } = require("quickmongo");
61+
const db = new Database("mongodb://localhost/quickmongo");
62+
63+
// Setting an object in the database:
64+
db.set("userInfo", { difficulty: "Easy" }).then(console.log);
65+
// -> { difficulty: 'Easy' }
66+
67+
db.push("userInfo.items", "Sword").then(console.log);
68+
// -> { difficulty: 'Easy', items: ['Sword'] }
69+
70+
db.add("userInfo.balance", 500).then(console.log);
71+
// -> { difficulty: 'Easy', items: ['Sword'], balance: 500 }
72+
73+
// Repeating previous examples:
74+
db.push("userInfo.items", "Watch").then(console.log);
75+
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 500 }
76+
77+
db.add("userInfo.balance", 500).then(console.log);
78+
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 1000 }
79+
80+
// Fetching individual properties
81+
db.get("userInfo.balance").then(console.log);
82+
// -> 1000
83+
db.get("userInfo.items").then(console.log);
84+
// -> ['Sword', 'Watch']
85+
```

docs/index.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: General
2+
files:
3+
- name: Welcome
4+
path: welcome.md

0 commit comments

Comments
 (0)