Revert readme changes I have imported from the wrong place
This commit is contained in:
parent
2dbc7a3a4c
commit
8bb0c4fd2f
5 changed files with 36 additions and 17 deletions
javascript/mongy
|
@ -1,30 +1,35 @@
|
|||
# 🚧 This repo has been moved to [prescientmoon/Mongy](https://github.com/prescientmoon/Mongy) 🚧
|
||||
# Mongy
|
||||
A high level interface for MongoDB built on top of Mongoose
|
||||
|
||||
A high level interface for MongoDB built on top of Mongoose
|
||||
|
||||
#Get started:
|
||||
|
||||
To get started, first install the package:
|
||||
|
||||
```
|
||||
npm install mongy
|
||||
```
|
||||
|
||||
Then you need to include it in your script:
|
||||
|
||||
```
|
||||
const Mongy = require("mongy");
|
||||
```
|
||||
|
||||
The next step is to create an instance of the Mongy class:
|
||||
|
||||
```
|
||||
const mydb = new Mongy();
|
||||
```
|
||||
|
||||
To connect to your datebase you need to call the 'connect' method:
|
||||
|
||||
```
|
||||
mydb.connect(process.env.DBURL);
|
||||
```
|
||||
|
||||
To create your first model call createModel(name,collection,schema):
|
||||
|
||||
```
|
||||
mydb.createModel("User","users",{
|
||||
name:String,
|
||||
|
@ -33,6 +38,7 @@ mydb.createModel("User","users",{
|
|||
```
|
||||
|
||||
To make an instance of the model call 'instantiate(name,data)':
|
||||
|
||||
```
|
||||
async function addUser(name,email){
|
||||
const myNewUser = mydb.instantiate("User",{name,email});
|
||||
|
@ -40,6 +46,7 @@ async function addUser(name,email){
|
|||
```
|
||||
|
||||
And then to save your model call the function 'saveModel':
|
||||
|
||||
```
|
||||
async function addUser(name,email){
|
||||
...
|
||||
|
@ -48,6 +55,7 @@ async function addUser(name,email){
|
|||
```
|
||||
|
||||
Then you can get the data of your user via the '.find(name,data)' method:
|
||||
|
||||
```
|
||||
async function getUsers(name){
|
||||
return await mydb.find("User",{name});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue