1e6c453191
When a callback is omitted from a DAO method, return a Promise that resolves to the value normally passed to the callback of that method. If a callback is provided, behave normally. This API will use native ES6 promises if available. If not available, or to force the use of another Promise library, you must assign the global.Promise object. e.g.: global.Promise = require('bluebird') Class methods affected: - create - updateOrCreate / upsert - findOrCreate - exists - find - findOne - findById - findByIds - remove / deleteAll / destroyAll - removeById / deleteById / destroyById - count - update / updateAll Prototype methods affected: - save - delete / remove / destroy - updateAttribute - updateAttributes - reload Exceptions / edge cases: - create() used to return the data object that was passed in, even if no callback was provided. Now, if a callback is provided, it will return the data object, otherwise it will return a Promise. - If create() is provided an array of data objects for creation, it will continue to always return the array. This batch creation mode does not support promises. - findOrCreate() has a callback of the form: cb(err, instance, created), with the extra parameter indicating whether the instance was created or not. When called with its promise variant, the resolver will receive a single array parameter: [instance, created] |
||
---|---|---|
docs | ||
examples | ||
lib | ||
support | ||
test | ||
.editorconfig | ||
.gitignore | ||
.gitmodules | ||
.jshintignore | ||
.npmignore | ||
.travis.yml | ||
CHANGES.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
Makefile | ||
README.md | ||
docs.json | ||
index.js | ||
package.json |
README.md
LoopBack DataSource Juggler
LoopBack DataSource Juggler is an ORM that provides a common set of interfaces for interacting with databases, REST APIs, and other data sources. It was initially forked from JugglingDB.
For full documentation, see the official StrongLoop documentation: Connecting models to data sources
For information on creating data sources programmatically, see Advanced topics: data sources.
Installation
npm install loopback-datasource-juggler
Also install the appropriated connector, for example for mongodb:
npm install loopback-connector-mongodb
See StrongLoop Documentation for more information.