1
0
Fork 0

added derived file

This commit is contained in:
Jan Steemann 2014-02-26 11:07:57 +01:00
parent 9a56f68468
commit a3cb0423c2
1 changed files with 22 additions and 15 deletions

View File

@ -315,8 +315,17 @@ ArangoCollection.prototype.type = function () {
////////////////////////////////////////////////////////////////////////////////
ArangoCollection.prototype.properties = function (properties) {
var requestResult;
var attributes = {
"doCompact": true,
"journalSize": true,
"waitForSync": true,
"shardKeys": false,
"numberOfShards": false,
"keyOptions": false
};
var a;
var requestResult;
if (properties === undefined) {
requestResult = this._database._connection.GET(this._baseurl("properties"));
@ -325,14 +334,12 @@ ArangoCollection.prototype.properties = function (properties) {
else {
var body = {};
if (properties.hasOwnProperty("doCompact")) {
body.doCompact = properties.doCompact;
}
if (properties.hasOwnProperty("journalSize")) {
body.journalSize = properties.journalSize;
}
if (properties.hasOwnProperty("waitForSync")) {
body.waitForSync = properties.waitForSync;
for (a in attributes) {
if (attributes.hasOwnProperty(a)) {
if (properties.hasOwnProperty(a) && properties[a]) {
body[a] = properties[a];
}
}
}
requestResult = this._database._connection.PUT(this._baseurl("properties"),
@ -341,12 +348,12 @@ ArangoCollection.prototype.properties = function (properties) {
arangosh.checkRequestResult(requestResult);
}
var result = {
waitForSync : requestResult.waitForSync,
journalSize : requestResult.journalSize,
isVolatile : requestResult.isVolatile,
doCompact : requestResult.doCompact
};
var result = { };
for (a in attributes) {
if (attributes.hasOwnProperty(a) && requestResult.hasOwnProperty(a)) {
result[a] = requestResult[a];
}
}
if (requestResult.keyOptions !== undefined) {
result.keyOptions = requestResult.keyOptions;