forked from codemix/oriento
-
Notifications
You must be signed in to change notification settings - Fork 0
Server
Giraldo Rosales edited this page Apr 23, 2014
·
4 revisions
Properties:
- sessionId (Number) - Unique session id automatically generated by the server.
- host (String) - Location of the server. Default: "localhost".
- port (Number) - Server port. Default: 2424.
- username (String) - Authentication username. Default: "admin".
- password (String) - Authentication password. Default: "admin".
- protocolVersion (Number) - Current server protocol
- logger (Object) - Logging utility
- socket (Object) - Socket server is using to connect.
## Connect > Oriento connects to the OrientDB server the first time it is needed, if no connection has already been made.
## List List all the databases on the server. > Note: there is no need to call `connect()`, the > connection is established the first time it is needed.
server.list();Response:
-
list (Object) - A list of database objects.
- Database (Object) - Database objects.
Example
server.list()
.then(function(list) {
console.log('Databases: ', list);
});## Exists Check whether a database exists. ```javascript server.exists(name); ``` **Parameters:** - **name** _(String)_ - Database name.
Response:
- results (Boolean) - If database exists, returns true. Otherwise false.
Example
server.exists('mydb')
.then(function(results) {
console.log('Database exists: ', results);
});## Configuration The configuration file is located in orientdb-server-config.xml, under: ` `
### List Get list of parameters set in the configuration. ```javascript server.config.list(); ```
Response:
-
list (Object) - List of parameters.
-
object (Object) - Config parameter object.
- name (String) - Parameters key.
- value (String) - Parameter value.
-
object (Object) - Config parameter object.
Example
server.config.list()
.then(function(list) {
console.log('List of the configuration properties: ' + list);
});### Get Get configuration parameters ```javascript server.config.get(key); ```
Parameters:
- key (String) - Property key.
Response:
- value (String) - Value of property.
Example:
server.config.get('db.pool.max')
.then(function(value) {
console.log('Config param, db.pool.max = ' + value);
});### Set Set a configuration parameter ```javascript server.config.set(key, value); ```
Parameters:
- key (String) - Property key.
- value (String) - Value of property.
Response:
- results (Boolean) - If property was set successfully, return true. Otherwise false.
Example:
server.config.set('db.pool.max', 10)
.then(function(results) {
console.log('Config param, db.pool.max updated? ', results);
});