mirror of https://gitee.com/bigwinds/arangodb
added derived file
This commit is contained in:
parent
9a56f68468
commit
a3cb0423c2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue