Distributed data management provides collaboration between databases of different devices for applications. The APIs provided by distributed data management can be used to save data to the distributed database and perform operations such as adding, deleting, modifying, and querying data in the distributed database.
Distributed data management provides collaboration between databases of different devices for applications. The APIs provided by distributed data management can be used to save data to the distributed database and perform operations such as adding, deleting, modifying, and querying data in the distributed database.
>**NOTE**<br/>
>**NOTE**<br/>
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -610,14 +611,14 @@ Defines the KV store constants.
...
@@ -610,14 +611,14 @@ Defines the KV store constants.
| --- | ---- | ----------------------- |
| --- | ---- | ----------------------- |
| MAX_KEY_LENGTH | 1024 | Maximum length (in bytes) of a key in the KV store. |
| MAX_KEY_LENGTH | 1024 | Maximum length (in bytes) of a key in the KV store. |
| MAX_VALUE_LENGTH | 4194303 | Maximum length (in bytes) of a value in the KV store. |
| MAX_VALUE_LENGTH | 4194303 | Maximum length (in bytes) of a value in the KV store. |
| MAX_KEY_LENGTH_DEVICE | 896 | Maximum length of the device coordinate key. |
| MAX_KEY_LENGTH_DEVICE | 896 | Maximum length of the device key, in bytes.|
| MAX_STORE_ID_LENGTH | 128 | Maximum length (in bytes) of a KV store ID. |
| MAX_STORE_ID_LENGTH | 128 | Maximum length (in bytes) of a KV store ID. |
| MAX_QUERY_LENGTH | 512000 | Maximum query length. |
| MAX_QUERY_LENGTH | 512000 | Maximum query length, in bytes.|
| MAX_BATCH_SIZE | 128 | Maximum size of a batch operation. |
| MAX_BATCH_SIZE | 128 | Maximum number of batch operations.|
## Schema<sup>8+</sup> ##
## Schema<sup>8+</sup> ##
Defines a database schema. When creating or opening a KV store, you can create a **Schema** object and put it into **Options**.
Defines the schema of a KV store. When creating or opening a KV store, you can create a **Schema** object and put it in [Options](#options).
| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| fieId | string | Yes |Field to match. It cannot contain '^'. |
**Return value**
**Return value**
...
@@ -2041,7 +2041,7 @@ Obtains the query statement of this **Query** object.
...
@@ -2041,7 +2041,7 @@ Obtains the query statement of this **Query** object.
| Type | Description |
| Type | Description |
| ------ | ------- |
| ------ | ------- |
| [Query](#query8) |**Query** object Created.|
| string |Query statement obtained.|
**Example**
**Example**
...
@@ -2058,9 +2058,7 @@ try {
...
@@ -2058,9 +2058,7 @@ try {
## KVStore
## KVStore
Provides methods to manage data in a KV store, for example, adding or deleting data and subscribing to data changes or completion of data synchronization. Before calling any method in **KVStore**, you must use **getKVStore** to obtain a **KVStore** object.
Provides methods to manage data in a KV store, for example, adding or deleting data and subscribing to data changes or completion of data synchronization. Before calling any method in **KVStore**, you must use [getKVStore](#getkvstore) to obtain a **KVStore** object.
@@ -2927,8 +2925,6 @@ These value types can be used only by internal applications.
...
@@ -2927,8 +2925,6 @@ These value types can be used only by internal applications.
Provides methods to query and synchronize data in a single KV store. This class inherits from **KVStore**. Before calling any method in **SingleKVStore**, you must use [getKVStore](#getkvstore) to obtain a **SingleKVStore** object.
Provides methods to query and synchronize data in a single KV store. This class inherits from **KVStore**. Before calling any method in **SingleKVStore**, you must use [getKVStore](#getkvstore) to obtain a **SingleKVStore** object.
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This API uses an asynchronous callback to return the result.
Closes the **KvStoreResultSet** object obtained by [SingleKvStore.getResultSet](#singlekvstore_getresultset). This API uses an asynchronous callback to return the result.
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This API uses a promise to return the result.
Closes the **KvStoreResultSet** object obtained by [SingleKvStore.getResultSet](#singlekvstore_getresultset). This API uses a promise to return the result.
Manually triggers KV store synchronization synchronously.
Manually triggers KV store synchronization synchronously. For details about the synchronization mode of the distributed data service, see [Distributed Data Service Overview] (../../database/database-mdds-overview.md).
@@ -3898,7 +3894,7 @@ Obtains the security level of this KV store. This API uses a promise to return t
...
@@ -3898,7 +3894,7 @@ Obtains the security level of this KV store. This API uses a promise to return t
| Type | Description |
| Type | Description |
| ------ | ------- |
| ------ | ------- |
|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level obtained.|
|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the value obtained.|
**Example**
**Example**
...
@@ -3920,8 +3916,6 @@ try {
...
@@ -3920,8 +3916,6 @@ try {
Provides methods to manage distributed data by device in the distributed system. This class inherits from **KVStore** and provides data query and synchronization methods. Before calling any method in **DeviceKVStore**, you must use [getKVStore](#getkvstore) to obtain a **DeviceKVStore** object.
Provides methods to manage distributed data by device in the distributed system. This class inherits from **KVStore** and provides data query and synchronization methods. Before calling any method in **DeviceKVStore**, you must use [getKVStore](#getkvstore) to obtain a **DeviceKVStore** object.
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This API uses an asynchronous callback to return the result.
Closes the **KvStoreResultSet** object obtained by [DeviceKVStore.getResultSet](#devicekvstore_getresultset). This API uses an asynchronous callback to return the result.
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This API uses a promise to return the result.
Closes the **KvStoreResultSet** object obtained by [DeviceKVStore.getResultSet](#devicekvstore_getresultset). This API uses a promise to return the result.
Manually triggers KV store synchronization synchronously.
Manually triggers KV store synchronization synchronously. For details about the synchronization mode of the distributed data service, see [Distributed Data Service Overview] (../../database/database-mdds-overview.md).