mongo-aql

An extensible SQL generation library for JavaScript with a focus on introspectibility

Showing:

Popularity

Downloads/wk

68

GitHub Stars

6

Maintenance

Last Commit

3mos ago

Contributors

15

Package

Dependencies

0

License

BSD-2-Clause

Type Definitions

Tree-Shakeable

No?

Categories

Readme

mongo-aql - JSON to AQL

##Install

$ npm i mongo-aql --save

##Usage

var builder = require('mongo-aql');

var q = {
    foo: { bar: 'baz', bar2: 'baz2' },
    "$limit": 10,
    "$skip": 100,
    "$orderby": { name: 1, name2: 1 },
    "@city": "cities",
    "@like": "likes"
}

var res = builder('users', q);

Result:

{ query: 'FOR u IN users FILTER u.foo.bar == @v0 && u.foo.bar2 == @v1 LIMIT @v2, @v3 SORT u.name ASC, u.name2 ASC LET c0 = DOCUMENT(@@v4, u.city) LET c1 = DOCUMENT(@@v5, u.like) RETURN merge(u, { city: c0 }, { like: c1 })',
  values:
   { v0: 'baz',
     v1: 'baz2',
     v2: 100,
     v3: 10,
     '@v4': 'cities',
     '@v5': 'likes' },
 }

##License

BSD

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100