arangolize
Advanced tools
Comparing version 0.9.2 to 0.9.3
{ | ||
"name": "arangolize", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Sequelize-like query-builder for ArangoDB", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,17 +9,29 @@ # Arangolize | ||
import arangolize from 'arangolize' | ||
import { Database } from 'arangojs' | ||
const { query, bindVars } = arangolize({ | ||
collection: 'Posts', // collection name | ||
limit: 10, // limits to 10 results | ||
skip: 10, // skip the first 10 results | ||
sort: '_createdAt DESC', // sort by `_createdAt` attribute, descending | ||
where: { body: 'I ❤️ Arango' }, // find based on keys and values. All must match | ||
include: [{ | ||
as: 'user' // take the value of field `user` and populate it with the corresponding document | ||
// `user` field bust be valid ArangoID | ||
}] | ||
}) | ||
/* | ||
You'll need to get the database and collection yourself. | ||
This tool just builds the query and bindVars object. | ||
// now use the qeury and bindVars as you normally would | ||
collection.query({ query, bindVars }) | ||
const db = new Database()... etc | ||
*/ | ||
async function getDocument () { | ||
const { query, bindVars } = await arangolize({ | ||
collection: 'Posts', // collection name | ||
limit: 10, // limits to 10 results | ||
skip: 10, // skip the first 10 results | ||
sort: '_createdAt DESC', // sort by `_createdAt` attribute, descending | ||
where: { body: 'I ❤️ Arango' }, // find based on keys and values. All must match | ||
include: [{ | ||
as: 'user' // take the value of field `user` and populate it with the corresponding document | ||
// `user` field bust be valid ArangoID | ||
}] | ||
}) | ||
// now use the qeury and bindVars as you normally would | ||
const data = await collection.query({ query, bindVars }) | ||
return data | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36
11718
6