All Projects → roboncode → Orango

roboncode / Orango

Licence: mit
ArangoDB Object Modeling for Node.js, Foxx and Modern Web Browsers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Orango

Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (+32.04%)
Mutual labels:  graphql, orm, odm
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (+133.01%)
Mutual labels:  orm, odm, nosql
Egg Graphql
Stars: ✭ 345 (+234.95%)
Mutual labels:  graphql, orm
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (+272.82%)
Mutual labels:  graphql, orm
Arangojs
The official ArangoDB JavaScript driver.
Stars: ✭ 503 (+388.35%)
Mutual labels:  nosql, arangodb
arangodb-java-driver-async
ArangoDB Asynchronous Java driver
Stars: ✭ 45 (-56.31%)
Mutual labels:  nosql, arangodb
Prisma1
💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB)
Stars: ✭ 16,851 (+16260.19%)
Mutual labels:  graphql, orm
Openrecord
Make ORMs great again!
Stars: ✭ 474 (+360.19%)
Mutual labels:  graphql, orm
fuerte
Low Level C++ Driver for ArangoDB
Stars: ✭ 41 (-60.19%)
Mutual labels:  nosql, arangodb
Pims
An ORM for document-oriented database systems, written in and for TypeScript.
Stars: ✭ 9 (-91.26%)
Mutual labels:  orm, arangodb
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+596.12%)
Mutual labels:  orm, nosql
Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-71.84%)
Mutual labels:  graphql, orm
AbacusUtil
Release the power in Java programming
Stars: ✭ 77 (-25.24%)
Mutual labels:  orm, nosql
fireo-nodejs
Google Cloud Firestore modern and simplest convenient ORM package in NodeJs. FireO is specifically designed for the Google's Firestore
Stars: ✭ 22 (-78.64%)
Mutual labels:  orm, odm
Mongoengine
MongoEngine is a Python Object-Document Mapper for working with MongoDB. Documentation is available at https://mongoengine-odm.readthedocs.io - there is currently a tutorial, a user guide, and an API reference.
Stars: ✭ 3,632 (+3426.21%)
Mutual labels:  orm, odm
doctrine-json-odm
JSON Object-Document Mapping bundle for Symfony and Doctrine
Stars: ✭ 15 (-85.44%)
Mutual labels:  orm, odm
Framework Learning
计算机学习资料(Java , Jvm , Linux , Mysql , Netty , Redis , Netty , Spring , SpringBoot , Mybatis , Rabbitmq ,计算机网络 , 数据结构与算法 , 设计模式 )Github网页阅读:https://guang19.github.io/framework-learning , Gitee网页版阅读: https://qsjzwithguang19forever.gitee.io/framework-learning
Stars: ✭ 416 (+303.88%)
Mutual labels:  orm, nosql
Fluent
Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
Stars: ✭ 1,071 (+939.81%)
Mutual labels:  orm, nosql
arangors
Easy to use rust driver for arangoDB
Stars: ✭ 120 (+16.5%)
Mutual labels:  nosql, arangodb
docs
Source code of the ArangoDB online documentation
Stars: ✭ 18 (-82.52%)
Mutual labels:  nosql, arangodb

Deprecated: Orango is no longer being maintained

orango

ArangoDB Object Modeling for Node.js, Foxx and Modern Web Browsers

Downloads Version License Build Status Coverage Status Commitizen Friendly

Orango is an ODM (Object Data Modeler), an ORM (Object Relational Mapper) and an OGM (Object Graphical Mapper) in one that provides the following features:

  • Central connectivity to ArangoDB
  • Automated creation of collections and indexes
  • Create schemas for data
  • Interact with models to handle data-centric functionality
  • Pre-populate database
  • Graph linking and querying
  • and more...

Why use Orango with ArangoDB?

  • Ease of use
  • Model-driven data
  • Focus on data instead of queries
  • Optimized query creation
  • Validation
  • Filter unknown data from being injected into database
  • Cleaner interfaces
  • Single point of change for bug fixes, features, etc
  • Save on redundancy - DRY implementation
  • Default values
  • and more...

Community Support

Join the Orango community

Documentation & Articles

Official documentation can be found at orango.js.org. (This is a work in progress)

I will be regularly posting articles on CodeBurst.io (Medium). Follow me there https://codeburst.io/@roboncode

Follow me on Twitter https://twitter.com/@roboncode for updates

Installation

First be sure you have ArangoDB and Node.js installed. You can install ArangoDB using the official docker container.

Next, install Orango from the command line using npm:

$ npm install orango

Importing

// Using Node.js `require()`
const orango = require('orango')

// Using ES6 imports
import orango from 'orango'

Overview

Connecting to ArangoDB

First, we need to define a connection. If your app uses the default _system database, you can connect using orango.connect(). If you need to create additional connections, use orango.get( database:String ).connect().

The method connect([{url:String="http://localhost:8529", username:String, password:String}]) takes database name with options to establish a connection. Otherwise, it will use the default values.

const orango = require('orango')
const { EVENTS } = orango.consts

orango.events.once(EVENTS.CONNECTED, conn => {
   console.log('🥑  Connected to ArangoDB:', conn.url + '/' + conn.name)
})

orango.events.once(EVENTS.READY, () => {
   console.log('🍊  Orango is ready!')
})

async function main() {
   await orango.connect()
}

main()

Note: Orango buffers model definitions, so they can be defined before or after a connection is established.

Defining a Model

const schema = new orango.Schema({
  author: String,
  title: String,
  body: String,
  date: Date
})

orango.model('Blog', schema)

Aside from defining the structure of your documents and data types, Orango models can handle the definition of:

  • Validators
  • Default values
  • Indexes
  • Static methods
  • Computed properties
  • Hooks
  • Custom queries
  • Unknown property filters
  • JSON to model structures
  • Joi definitions

The following example shows some of these features:

const Joi = require('joi')
const { SCHEMA } = orango.consts
  
class UserSchema extends orango.Schema {
  // computed properties
  get fullName() {
    return (this.firstName + ' ' + this.lastName).trim()
  }
}

let schema = new UserSchema({
  firstName: String,
  lastName: String,
  // Joi can be used directly
  email: Joi.string().email(),
  // JSON gets converted to Joi data types automatically
  age: { type: Number, min: 18 },
  bio: { type: String, regex: /[a-z]/ },
  // default values are supported on insert and update
  created: { type: Date, default: Date.now },
  updated: { type: Date, defaultOnUpdate: Date.now }
})

schema.addIndex(SCHEMA.INDEX.HASH, 'email')
schema.addIndex(SCHEMA.INDEX.SKIP_LIST, ['firstName', 'lastName'])

let User = orango.model('User', schema)

// extend your model with custom functions
User.findByEmail = async function(email) {
  return await this.find().one().where({ email })
}

In code somewhere else

const User = orango.model('User')

...

let user = await User.findByEmail('[email protected]').return({ model: true })
console.log('Hello,', user.name) // access model getter

Examples

A growing set of examples are available here. To run the examples, clone this project and then run the Orango docker containers.

Install dependencies

npm install

Run the docker containers provided by Orango

Linux and Mac

Run the ArangoDB containers provided by Orango.

$ make dbs

Windows

$ cd docker & docker-compose up -d

Run examples

npm run examples

You will be presented with a wizard where you can run different examples files.

Terminal Screenshot

Debugging the examples with VSCode

Setup your config like the example below. You can launch any number of the snippets by placing the snippet you would like to start in the args array. Then run the debugger. The output will be in the Debug Console.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Count",
      "program": "${workspaceFolder}/examples/debug.js",
      "args": ["count"]
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Find First",
      "program": "${workspaceFolder}/examples/debug.js",
      "args": ["find_first"]
    }
  ]
}

License

MIT

Copyright (c) 2018-present, Rob Taylor

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].