This repository has been archived by the owner on Mar 4, 2019. It is now read-only.
v4.0.0
We're sticking to proper semver now, so this is a much less radical change than v2 to v3 was π
Breaking changes
- JSON traversal is now a lot simpler! If you were only using the built-in document table functionality, no need to worry since that's the same; but if you were building criteria objects with keys like
my_json_field->>innerField
, you can now use standard JavaScript.
and[]
notation and Massive will take care of the rest. find
has been standardized on criteria objects, and will no longer accept a*
wildcard.- Loader filters are also standardized: schema filters no longer accept
all
or*
wildcards.
New stuff
Only one item in here, but it's a big one: resultset decomposition has arrived! Check out the documentation for a full description, but otherwise I'll let the testcase speak for itself:
const issues = yield db.everything.find({}, {
decompose: {
pk: 'user_id',
columns: {
user_id: 'id',
username: 'username'
},
tests: {
pk: 'test_id',
columns: {
test_id: 'id',
name: 'name'
},
array: true,
issues: {
pk: 'id',
columns: {
id: 'id',
user_id: 'user_id',
test_id: 'test_id',
description: 'description'
},
array: true
}
}
}
});
assert.deepEqual(issues, [{
id: 1,
username: 'alice',
tests: [{
id: 1,
name: 'alice\'s test',
issues: [{
id: 1,
user_id: 1,
test_id: 1,
description: 'alice\'s issue'
}]
}]
}, {
id: 2,
username: 'bob',
tests: []
}, {
id: 3,
username: 'carol',
tests: [{
id: 2,
name: 'carol\'s first test',
issues: []
}, {
id: 3,
name: 'carol\'s second test',
issues: [{
id: 2,
user_id: 3,
test_id: 3,
description: 'carol\'s issue'
}]
}]
}]);