Releases: appscot/sails-orientdb
OrientJS
RIP Oriento
Bug in `join` and a performance improvement
Increment
Adds custom method .increment()
#109
.increment (criteria, field[, amount][, cb])
Increments the given field by amount (defaults to 1
). This can be used to generate sequencial numbers, more about this in OrientDB docs.
usage:
// Given a model Counter with attributes `name` and `value`
Counter.increment({ name: 'counter1' }, 'value', function (err, counter) {
console.log('counter1 has increased by 1 to:', counter.value);
});
// To decrement use negative numbers
Counter.increment({ name: 'counter1' }, 'value', -2)
.then(function (counter) {
console.log('counter1 haas decreased by 2 to:', counter.value);
});
Schemaless, connection pool, and promises
- Full support for schemaless mode (passes all waterline integration tests) #85;
.query()
,.createEdge()
and.deleteEdges()
return promises: #97;- Adds support for connection pooling #92;
- Explicitly implement the new waterline SQL interface;
- Support for DB only credentials (thanks @matanshukry!) #86;
- Bug fix: delete vertex with custom PK #105;
- Allows sails-orientdb to be initialised without model definitions: #90;
- Adds mores tests (#81, #82).
NOTE: This was meant to be v0.10.51 but I had to bump it up due to https://github.com/npm/npm-www/issues/537
sails-orientdb
waterline-orientdb is dead, long live sails-orientdb
In the interest of the community Srinath, Gaurav and Dário are combining their efforts in a single Waterline/Sails OrientDB adapter. We've decided to name it after the original adapter: sails-orientdb
hence these changes. More about this in the history section.
This release doesn't have any real code changes, it was mostly about renaming waterline-orientdb to sails-orientdb and making the appropriate config changes.
It seems that the old gitter room vanished, our apologies for that.
Better Index Support
runFunction() and performance improvements
- Adds runFunction method to adapter;
- native(), getDB(), getServer() and removeCircularReferences() are now synced. The async calls with callback will still be supported for backwards compatibility but are no longer the preferred way of using these methods;
- Performance:
define()
will now create properties at once instead of one by one. Added a quickerunsafeDrop
option; - Added examples and tests;
- Exposes Oriento logger config to adapter;
- Performance: replaced decodeURIComponent for string.replace as it's around 25% faster.
The big refactor ("2.0")
Changes
- Many-to-many join tables are now edges (#29)
- Make code simpler by alleviating connection.js and creating a new class
Collection
. Collection itself can be aDocument
,Edge
orVertex
. This makes it simpler to segregate class logic and to extend behaviour. - Support Syncable
- Support interface "migratable"
- Improve code coverage
- Add more tests
- Move all default configs to adapter
- Add support to document databases (in addition to graph dbs)
- orientdbClass: ability to force a model to be a given class
- decodeURIComponent config, when enabled
id
is decoded (makes it sails/blueprints friendly) - support schemaless: actually pay attention to the schema flag to avoid the need for hacks like this.
Notes
Given the size and extension of these changes it's possible that this new version will behave differently in extreme scenarios. All has been done to mitigate that, including adding more automated tests. Changes to be aware:
Associations: many-to-many join tables will now be edges
If database type is set to graph then waterline-orientdb will use edges instead of join tables.
Migratabable
One change to be aware is the way waterline-orientdb
will handle classes creation at start up. In the past waterline-orientdb
would not touch existing classes and would create missing ones. Now it conforms to the waterline Auto Migration Strategies:
"safe"
(default in production env)
- do nothing
"drop"
(default in development env)
- drop all tables and recreate them each time the server starts-- useful for development
"alter"
- experimental automigrations
orientdbClass
From now on it will be possible to force the class of a model by adding the property orientdbClass
to the definition. Generally this is not required as waterline-orientdb
can determine which is the best class to use, so it should only be used in special cases. Possible values:
undefined
-waterline-orientdb
will determine which class to use. In graph dbs it will be vertex for non junction collections and edge for association junction tables""
or"document"
- class will be the default OrientDB document class;"V"
- class will be Vertex;"E"
- class will be Edge.
Example:
{
identity : 'post',
orientdbClass : 'V'
attributes : {
name : 'string'
}
}
Note, when using a document database (through config.options.databaseType
), orientdbClass class will be ignored and all classes will be documents
Adds support for id declarations on model
- Made waterline-orientdb more robust when
id
is declared in the model to improve blueprints compatibility - Added workaround for issue introduced with oriento@1.1.3 where it was impossible to save json (embedded) records.