1.0.8 • Published 4 years ago

mongoengine v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Work In Progress - Do Not Install

What is Mongoengine???

An extremely simple mongodb JS engine that aims to provide the following:

  1. Easy and convenient way to map collections to JS Classes
    import { Collection } from "mongoengine";
    import { Stringfield, Datefield, Objectfield, Identifier } from "mongoengine";
class Customer extends Collection {
    readonly name CollectionName = "customer";  //use this as collection name in the db


    _id = Identifier();  //pass in a () => {} to generate custom id's or leave blank for server side generated _ids

    name = Stringfield("name", {default: 'Guest'})
    email = Stringfield("email", {required: true, unique: true})
    phone = Stringfield("phone_number") //leave out optional options
}

let customer = new Customer()

customer.name("Raymond");  //set customer name to Raymond
customer.email("nospam@example.com");
customer.phone("+1-563-489238");

customer.commit();  //save customer to db
```
  1. Inuitive MongoDB Query Syntax

    let email = "nospam@example.com";
    let limit = 10;
    
    cust = Customer.$eq("email", email).fetch(limit);
//Now customer has an ID
let id = customer._id()
const customerName = customer.name();  //read the customer name
```
  1. Automatic Connection Pooling and Context Management. Simply set environmental variables and write your custom code logic
    export MONGO_URL="https://live-ddml-atlas.mongodb.com"
    export MONGO_HOST="mongo.example.com"
    export MONGO_DATABASE="testdb"
    export MONGO_PORT=37027
    export MONGO_USER="ironman"
    export MONGO_PASSWORD="********"
    export MONGO_POOL=15
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago