diff --git a/3.5/appendix-references-dbobject.md b/3.5/appendix-references-dbobject.md index 5239c492c9..1332f51c99 100644 --- a/3.5/appendix-references-dbobject.md +++ b/3.5/appendix-references-dbobject.md @@ -30,7 +30,7 @@ The following methods exists on the *_db* object: * [db._isSystem()](data-modeling-databases-working-with.html#issystem) * [db._name()](data-modeling-databases-working-with.html#name) * [db._path()](data-modeling-databases-working-with.html#path) -* [db._version()](data-modeling-documents-document-methods.html#get-the-version-of-arangodb) +* [db._queryProperties()](data-modeling-databases-working-with.html#properties) *Collection* @@ -67,3 +67,4 @@ The following methods exists on the *_db* object: * [db._engine()](data-modeling-databases-working-with.html#engine) * [db._engineStats()](data-modeling-databases-working-with.html#engine-statistics) * [db._executeTransaction()](transactions-transaction-invocation.html) +* [db._version()](data-modeling-databases-working-with.html#get-the-version-of-arangodb) diff --git a/3.5/data-modeling-databases-working-with.md b/3.5/data-modeling-databases-working-with.md index 74f9c4c2b9..39bace4a27 100644 --- a/3.5/data-modeling-databases-working-with.md +++ b/3.5/data-modeling-databases-working-with.md @@ -88,6 +88,31 @@ database management operations such as create or drop can only be executed from within this database. Additionally, the *_system* database itself cannot be dropped. +### Properties + + + +return the path to database files +`db._queryProperties()` + +Returns the properties of the current database as an object with the following +attributes: + +- *id*: the database id +- *name*: the database name +- *isSystem*: the database type +- *path*: the path to database files + +**Examples** + +{% arangoshexample examplevar="examplevar" script="script" result="result" %} +@startDocuBlockInline dbProperties +@EXAMPLE_ARANGOSH_OUTPUT{dbProperties} + require("@arangodb").db._queryProperties(); +@END_EXAMPLE_ARANGOSH_OUTPUT +@endDocuBlock dbProperties +{% endarangoshexample %} +{% include arangoshexample.html id=examplevar script=script result=result %} ### Use Database @@ -203,10 +228,29 @@ as a list of supported features (types of indexes and ### Engine statistics -retrieve statistics related to the storage engine (rocksdb) +retrieve statistics related to the storage engine (RocksDB) `db._engineStats()` Returns some statistics related to the storage engine activity, including figures about data size, cache usage, etc. **Note**: Currently this only produces useful output for the RocksDB engine. + +Get the Version of ArangoDB +--------------------------- + +`db._version()` + +Returns the server version string. Note that this is not the version of the +database. + +**Examples** + +{% arangoshexample examplevar="examplevar" script="script" result="result" %} + @startDocuBlockInline dbVersion + @EXAMPLE_ARANGOSH_OUTPUT{dbVersion} + require("@arangodb").db._version(); + @END_EXAMPLE_ARANGOSH_OUTPUT + @endDocuBlock dbVersion +{% endarangoshexample %} +{% include arangoshexample.html id=examplevar script=script result=result %} diff --git a/3.5/data-modeling-documents-document-methods.md b/3.5/data-modeling-documents-document-methods.md index 2dfe10d1b8..b7de2c231b 100644 --- a/3.5/data-modeling-documents-document-methods.md +++ b/3.5/data-modeling-documents-document-methods.md @@ -1255,25 +1255,6 @@ Throws if the document key is invalid. Note that this method does not check whether the document already exists in this collection. -Get the Version of ArangoDB ---------------------------- - -`db._version()` - -Returns the server version string. Note that this is not the version of the -database. - - -**Examples** -{% arangoshexample examplevar="examplevar" script="script" result="result" %} - - @startDocuBlockInline dbVersion - @EXAMPLE_ARANGOSH_OUTPUT{dbVersion} - require("@arangodb").db._version(); - @END_EXAMPLE_ARANGOSH_OUTPUT - @endDocuBlock dbVersion -{% endarangoshexample %} -{% include arangoshexample.html id=examplevar script=script result=result %} Edges ----- diff --git a/3.6/appendix-references-dbobject.md b/3.6/appendix-references-dbobject.md index 5239c492c9..42dc9a53e8 100644 --- a/3.6/appendix-references-dbobject.md +++ b/3.6/appendix-references-dbobject.md @@ -30,7 +30,7 @@ The following methods exists on the *_db* object: * [db._isSystem()](data-modeling-databases-working-with.html#issystem) * [db._name()](data-modeling-databases-working-with.html#name) * [db._path()](data-modeling-databases-working-with.html#path) -* [db._version()](data-modeling-documents-document-methods.html#get-the-version-of-arangodb) +* [db._properties()](data-modeling-databases-working-with.html#properties) *Collection* @@ -67,3 +67,4 @@ The following methods exists on the *_db* object: * [db._engine()](data-modeling-databases-working-with.html#engine) * [db._engineStats()](data-modeling-databases-working-with.html#engine-statistics) * [db._executeTransaction()](transactions-transaction-invocation.html) +* [db._version()](data-modeling-databases-working-with.html#get-the-version-of-arangodb) diff --git a/3.6/data-modeling-databases-working-with.md b/3.6/data-modeling-databases-working-with.md index 74f9c4c2b9..cd3df69f1b 100644 --- a/3.6/data-modeling-databases-working-with.md +++ b/3.6/data-modeling-databases-working-with.md @@ -13,18 +13,17 @@ Please note that several of these methods can be used from the _system database only. ### Name - + return the database name `db._name()` Returns the name of the current database as a string. - **Examples** -{% arangoshexample examplevar="examplevar" script="script" result="result" %} +{% arangoshexample examplevar="examplevar" script="script" result="result" %} @startDocuBlockInline dbName @EXAMPLE_ARANGOSH_OUTPUT{dbName} require("@arangodb").db._name(); @@ -34,18 +33,17 @@ Returns the name of the current database as a string. {% include arangoshexample.html id=examplevar script=script result=result %} ### ID - + return the database id `db._id()` Returns the id of the current database as a string. - **Examples** -{% arangoshexample examplevar="examplevar" script="script" result="result" %} +{% arangoshexample examplevar="examplevar" script="script" result="result" %} @startDocuBlockInline dbId @EXAMPLE_ARANGOSH_OUTPUT{dbId} require("@arangodb").db._id(); @@ -55,18 +53,17 @@ Returns the id of the current database as a string. {% include arangoshexample.html id=examplevar script=script result=result %} ### Path - + return the path to database files `db._path()` Returns the filesystem path of the current database as a string. - **Examples** -{% arangoshexample examplevar="examplevar" script="script" result="result" %} +{% arangoshexample examplevar="examplevar" script="script" result="result" %} @startDocuBlockInline dbPath @EXAMPLE_ARANGOSH_OUTPUT{dbPath} require("@arangodb").db._path(); @@ -76,8 +73,8 @@ Returns the filesystem path of the current database as a string. {% include arangoshexample.html id=examplevar script=script result=result %} ### isSystem - + return the database type `db._isSystem()` @@ -88,10 +85,40 @@ database management operations such as create or drop can only be executed from within this database. Additionally, the *_system* database itself cannot be dropped. +### Properties -### Use Database +return the path to database files +`db._properties()` + +Returns the properties of the current database as an object with the following +attributes: + +- *id*: the database id +- *name*: the database name +- *isSystem*: the database type +- *path*: the path to database files +- *sharding*: the sharding method to use for new collections *(Cluster only)* +- *replicationFactor*: default replication factor for new collections + *(Cluster only)* +- *writeConcern*: a shard will refuse to write if less than this amount + of copies are in sync *(Cluster only)* + +**Examples** + +{% arangoshexample examplevar="examplevar" script="script" result="result" %} +@startDocuBlockInline dbProperties_cluster +@EXAMPLE_ARANGOSH_OUTPUT{dbProperties_cluster} + require("@arangodb").db._properties(); +@END_EXAMPLE_ARANGOSH_OUTPUT +@endDocuBlock dbProperties_cluster +{% endarangoshexample %} +{% include arangoshexample.html id=examplevar script=script result=result %} + +### Use Database + + change the current database `db._useDatabase(name)` @@ -110,10 +137,9 @@ database might not work, and the connection / session should be closed and restarted with different username and password credentials and/or endpoint data. - ### List Databases - + return the list of all existing databases `db._databases()` @@ -121,10 +147,9 @@ return the list of all existing databases Returns the list of all databases. This method can only be used from within the *_system* database. - ### Create Database - + create a new database `db._createDatabase(name, options, users)` @@ -138,19 +163,29 @@ change into the current database to the new database. Changing the current database must explicitly be requested by using the *db._useDatabase* method. -The *options* attribute currently has no meaning and is reserved for -future use. +The *options* attribute can be used to set defaults for collections that will +be created in the new database: + +- *sharding*: The sharding method to use. Valid values are: `""` or `"single"`. + Setting this option to `"single"` will enable the OneShard feature in the + Enterprise Edition. +- *replicationFactor*: Default replication factor. Special values include + `"satellite"`, which will replicate the collection to every DBServer, and + `1`, which disables replication. +- *minReplicationFactor*: Default minimum replication factor. If there are + less than minReplication replicas available the collection will become + read-only. The optional *users* attribute can be used to create initial users for the new database. If specified, it must be a list of user objects. Each user object can contain the following attributes: -* *username*: the user name as a string. This attribute is mandatory. -* *passwd*: the user password as a string. If not specified, then it defaults +- *username*: the user name as a string. This attribute is mandatory. +- *passwd*: the user password as a string. If not specified, then it defaults to an empty string. -* *active*: a boolean flag indicating whether the user account should be +- *active*: a boolean flag indicating whether the user account should be active or not. The default value is *true*. -* *extra*: an optional JSON object with extra user information. The data +- *extra*: an optional JSON object with extra user information. The data contained in *extra* will be stored for the user but not be interpreted further by ArangoDB. @@ -163,22 +198,21 @@ into the new database (username and password must be identical to the current session) and add or modify users with the following commands. ```js - require("@arangodb/users").save(username, password, true); - require("@arangodb/users").update(username, password, true); - require("@arangodb/users").remove(username); +require("@arangodb/users").save(username, password, true); +require("@arangodb/users").update(username, password, true); +require("@arangodb/users").remove(username); ``` Alternatively, you can specify user data directly. For example: ```js - db._createDatabase("newDB", {}, [{ username: "newUser", passwd: "123456", active: true}]) +db._createDatabase("newDB", {}, [{ username: "newUser", passwd: "123456", active: true}]) ``` Those methods can only be used from within the *_system* database. - ### Drop Database - + drop an existing database `db._dropDatabase(name)` @@ -203,10 +237,29 @@ as a list of supported features (types of indexes and ### Engine statistics -retrieve statistics related to the storage engine (rocksdb) +retrieve statistics related to the storage engine (RocksDB) `db._engineStats()` Returns some statistics related to the storage engine activity, including figures about data size, cache usage, etc. **Note**: Currently this only produces useful output for the RocksDB engine. + +Get the Version of ArangoDB +--------------------------- + +`db._version()` + +Returns the server version string. Note that this is not the version of the +database. + +**Examples** + +{% arangoshexample examplevar="examplevar" script="script" result="result" %} + @startDocuBlockInline dbVersion + @EXAMPLE_ARANGOSH_OUTPUT{dbVersion} + require("@arangodb").db._version(); + @END_EXAMPLE_ARANGOSH_OUTPUT + @endDocuBlock dbVersion +{% endarangoshexample %} +{% include arangoshexample.html id=examplevar script=script result=result %} diff --git a/3.6/data-modeling-documents-document-methods.md b/3.6/data-modeling-documents-document-methods.md index 2dfe10d1b8..b7de2c231b 100644 --- a/3.6/data-modeling-documents-document-methods.md +++ b/3.6/data-modeling-documents-document-methods.md @@ -1255,25 +1255,6 @@ Throws if the document key is invalid. Note that this method does not check whether the document already exists in this collection. -Get the Version of ArangoDB ---------------------------- - -`db._version()` - -Returns the server version string. Note that this is not the version of the -database. - - -**Examples** -{% arangoshexample examplevar="examplevar" script="script" result="result" %} - - @startDocuBlockInline dbVersion - @EXAMPLE_ARANGOSH_OUTPUT{dbVersion} - require("@arangodb").db._version(); - @END_EXAMPLE_ARANGOSH_OUTPUT - @endDocuBlock dbVersion -{% endarangoshexample %} -{% include arangoshexample.html id=examplevar script=script result=result %} Edges -----