Skip to content

Commit 043eeae

Browse files
authored
Merge pull request #2031 from Danielle9897/RDoc-3311-createDatabaseOperation
RDoc-3311 Add builder examples to CreateDatabaseOperation + fix article & examples (C# only)
2 parents 70721c8 + d24f90d commit 043eeae

File tree

13 files changed

+2335
-2
lines changed

13 files changed

+2335
-2
lines changed

Documentation/6.0/Raven.Documentation.Pages/client-api/operations/server-wide/create-database.dotnet.markdown

Lines changed: 148 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Create Database Operation
2+
---
3+
4+
{NOTE: }
5+
6+
* Use `CreateDatabaseOperation` to create a new database from the **Client API**, as described below.
7+
To create a new database from the **Studio**, see [Create database](../../../studio/database/create-new-database/general-flow).
8+
9+
* This operation requires a client certificate with a security clearance of _Operator_ or _ClusterAdmin_.
10+
To learn which operations are allowed at each level, see [Security clearance and permissions](../../../server/security/authorization/security-clearance-and-permissions).
11+
12+
* In this article:
13+
* [Create new database](../../../client-api/operations/server-wide/create-database#create-new-database)
14+
* [Example I - Create database](../../../client-api/operations/server-wide/create-database#example-i---create-non-sharded-database)
15+
* [Example II - Ensure database does not exist before creating](../../../client-api/operations/server-wide/create-database#example-ii---ensure-database-does-not-exist-before-creating)
16+
* [Syntax](../../../client-api/operations/server-wide/create-database#syntax)
17+
18+
{NOTE/}
19+
20+
---
21+
22+
{PANEL: Create new database}
23+
24+
{CONTENT-FRAME: }
25+
26+
##### Example I - Create database
27+
---
28+
29+
* The following simple example creates a non-sharded database with the default replication factor of 1.
30+
31+
{CODE:java CreateDatabase@ClientApi\Operations\Server\CreateDeleteDatabase.java /}
32+
33+
{CONTENT-FRAME/}
34+
{CONTENT-FRAME: }
35+
36+
##### Example II - Ensure database does not exist before creating
37+
---
38+
39+
* To ensure the database does not already exist before creating it, follow this example:
40+
41+
{CODE:java EnsureDatabaseExists@ClientApi\Operations\Server\CreateDeleteDatabase.java /}
42+
43+
{CONTENT-FRAME/}
44+
{PANEL/}
45+
46+
{PANEL: Syntax}
47+
48+
{CODE:java create_database_syntax@ClientApi\Operations\Server\CreateDeleteDatabase.java /}
49+
50+
| Parameter | Type | Description |
51+
|-----------------------|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
52+
| **databaseRecord** | DatabaseRecord | Instance of `DatabaseRecord` containing database configuration. |
53+
| **replicationFactor** | int | Number of nodes the database should be replicated to.<br><br>If not specified, the value is taken from `topology.replicationFactor`,<br>or defaults to **`1`** if that is not set.<br><br>If `topology` is provided, the `replicationFactor` is ignored. |
54+
55+
## DatabaseRecord
56+
57+
`DatabaseRecord` is a collection of database configurations.
58+
59+
| constructor | Description |
60+
|---------------------------------------|----------------------------------|
61+
| DatabaseRecord(`string` databaseName) | Initialize a new database record |
62+
63+
{INFO: }
64+
65+
**Note:**
66+
67+
* Only the properties listed in the table below can be configured in the `DatabaseRecord` object passed to `CreateDatabaseOperation`.
68+
* For example, although ongoing task definitions are public on the _DatabaseRecord_ class, setting them during database creation will result in an exception.
69+
To define ongoing tasks (e.g., backups, ETL, replication), use the appropriate dedicated operation after the database has been created.
70+
71+
{INFO/}
72+
73+
| Property | Type | Description |
74+
|------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75+
| **analyzers** | `Map<String, AnalyzerDefinition>` | A dictionary defining the [Custom Analyzers](../../../indexes/using-analyzers#creating-custom-analyzers) available to the database. |
76+
| **autoIndexes** | `Map<String, AutoIndexDefinition>` | Auto-index definitions for the database. |
77+
| **client** | `ClientConfiguration` | [Client behavior](../../../studio/server/client-configuration) configuration. |
78+
| **conflictSolverConfig** | `ConflictSolver` | Define the strategy used to resolve [Replication conflicts](../../../server/clustering/replication/replication-conflicts). |
79+
| **dataArchival** | `DataArchivalConfiguration` | [Data Archival](../../../server/extensions/archival) configuration for the database. |
80+
| **databaseName** | `String` | The database name. |
81+
| **disabled** | `boolean` (default: false) | Set the database initial state.<br> `true` - disable the database.<br> `false` - (default) the database will be enabled.<br><br>This can be modified later via [ToggleDatabasesStateOperation](../../../client-api/operations/server-wide/toggle-databases-state). |
82+
| **documentsCompression** | `DocumentsCompressionConfiguration` | Configuration settings for [Compressing documents](../../../server/storage/documents-compression). |
83+
| **elasticSearchConnectionStrings** | `Map<String, ElasticSearchConnectionString>` | Define [ElasticSearch Connection Strings](../../../client-api/operations/maintenance/connection-strings/add-connection-string#add-an-elasticsearch-connection-string), keyed by name. |
84+
| **encrypted** | `boolean` (default: false) | `true` - create an [Encrypted database](../../../server/security/encryption/database-encryption).<br><br>Note: Use `PutSecretKeyCommand` to send your secret key to the server BEFORE creating the database.<br><br>`false` - (default) the database will not be encrypted. |
85+
| **expiration** | `ExpirationConfiguration` | [Expiration](../../../server/extensions/expiration) configuration for the database. |
86+
| **indexes** | `Map<String, IndexDefinition>` | Define [Indexes](../../../client-api/operations/maintenance/indexes/put-indexes) that will be created with the database - <br>no separate deployment needed. |
87+
| **integrations** | `IntegrationConfigurations` | Configuration for [Integrations](../../../integrations/postgresql-protocol/overview),<br>e.g. `PostgreSqlConfiguration`. |
88+
| **lockMode** | `DatabaseLockMode` | Set the database lock mode.<br>(default: `Unlock`)<br><br>This can be modified later via `SetDatabasesLockOperation`. |
89+
| **olapConnectionStrings** | `Map<String, OlapConnectionString>` | Define [OLAP Connection Strings](../../../client-api/operations/maintenance/connection-strings/add-connection-string#add-an-olap-connection-string), keyed by name. |
90+
| **queueConnectionStrings** | `Map<String, QueueConnectionString>` | Define [Queue Connection Strings](../../../server/ongoing-tasks/etl/queue-etl/overview), keyed by name. |
91+
| **ravenConnectionStrings** | `Map<String, RavenConnectionString>` | Define [Raven Connection Strings](../../../client-api/operations/maintenance/connection-strings/add-connection-string#add-a-ravendb-connection-string), keyed by name. |
92+
| **refresh** | `RefreshConfiguration` | [Refresh](../../../server/extensions/refresh) configuration for the database. |
93+
| **revisions** | `RevisionsConfiguration` | [Revisions](../../../document-extensions/revisions/client-api/operations/configure-revisions) configuration for the database. |
94+
| **revisionsForConflicts** | `RevisionsCollectionConfiguration` | Set the revisions configuration for conflicting documents. |
95+
| **rollingIndexes** | `Map<String, RollingIndex>` | Dictionary mapping index names to their deployment configurations. |
96+
| **settings** | `Map<String, String>` | [Configuration](../../../server/configuration/configuration-options) settings for the database. |
97+
| **sharding** | `ShardingConfiguration` | The sharding configuration. |
98+
| **sorters** | `Map<String, SorterDefinition>` | A dictionary defining the [Custom Sorters](../../../studio/database/settings/custom-sorters) available to the database. |
99+
| **sqlConnectionStrings** | `Map<String, SqlConnectionString>` | Define [SQL Connection Strings](../../../client-api/operations/maintenance/connection-strings/add-connection-string#add-an-sql-connection-string), keyed by name. |
100+
| **studio** | `StudioConfiguration` | [Studio Configuration](../../../studio/database/settings/studio-configuration). |
101+
| **timeSeries** | `TimeSeriesConfiguration` | [Time series](../../../studio/database/settings/time-series-settings) configuration for the database. |
102+
| **topology** | `DatabaseTopology` | Optional topology configuration.<br><br>Defaults to `null`, in which case the server will determine which nodes to place the database on, based on the specified `ReplicationFactor`. |
103+
| **unusedDatabaseIds** | `Set<String>` | Set database IDs that will be excluded when creating new change vectors. |
104+
105+
{PANEL/}
106+
107+
## Related Articles
108+
109+
- [Distributed Database](../../../server/clustering/distribution/distributed-database)
110+
- [Create Database via Studio](../../../studio/database/create-new-database/general-flow)

Documentation/6.0/Raven.Documentation.Pages/studio/database/create-new-database/general-flow.markdown

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33

44
{NOTE: }
55

6-
* From Studio, the database creation options are:
6+
* From the Studio, the database creation options are:
77
* **Regular** database - see [below](../../../studio/database/create-new-database/general-flow#1.-new-database).
88
* **Encrypted** database - see [Encrypted Database](../../../studio/database/create-new-database/encrypted).
99
* Create a database from a **Backup** copy - see [From Backup](../../../studio/database/create-new-database/from-backup).
1010
* Create a database from a **Previous** RavenDB version database - see [From Legacy File](../../../studio/database/create-new-database/from-legacy-files).
1111
* Create a [Sharded](../../../sharding/overview) database -
1212
see the [sharding Studio administration](../../../sharding/administration/studio-admin#creating-a-sharded-database) page.
1313

14-
* In this page:
14+
* To create a new database using the Client API, see [Create database operation](../../../client-api/operations/server-wide/create-database).
15+
16+
---
17+
18+
* In this article:
1519
* [1. New Database](../../../studio/database/create-new-database/general-flow#1.-new-database)
1620
* [2. Database Name](../../../studio/database/create-new-database/general-flow#2.-database-name)
1721
* [3. Configure Replication](../../../studio/database/create-new-database/general-flow#3.-configure-replication)

0 commit comments

Comments
 (0)