diff --git a/en/application-dev/reference/apis/js-apis-distributed-data.md b/en/application-dev/reference/apis/js-apis-distributed-data.md
index 843d49ad0e3dde124a591be3c24d6e0a860ed8ca..ce1692a8b20588c1b332eec8739d260158e7d6ee 100644
--- a/en/application-dev/reference/apis/js-apis-distributed-data.md
+++ b/en/application-dev/reference/apis/js-apis-distributed-data.md
@@ -1,7 +1,6 @@
# Distributed Data Management
->![](../../public_sys-resources/icon-note.gif) **NOTE**
->
+>![](../../public_sys-resources/icon-note.gif) **NOTE**
>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.
@@ -10,10 +9,6 @@
```
import distributedData from '@ohos.data.distributedData';
```
-## System Capabilities
-SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-
-
## distributedData.createKVManager
@@ -22,17 +17,18 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>
Creates a **KVManager** object to manage key-value (KV) stores. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+**Parameters**
| Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ |
-| config | [KVManagerConfig](#kvmanagerconfig) | Yes| Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
-| callback | AsyncCallback<[KVManager](#kvmanager)> | Yes| Callback invoked to return the **KVManager** object created.|
+| config | [KVManagerConfig](#kvmanagerconfig) | Yes | Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
+| callback | AsyncCallback<[KVManager](#kvmanager)> | Yes | Callback invoked to return the **KVManager** object created.|
-- Example
+**Example**
- ```
let kvManager;
try {
const kvManagerConfig = {
@@ -53,7 +49,6 @@ Creates a **KVManager** object to manage key-value (KV) stores. This method uses
} catch (e) {
console.log("An unexpected error occurred. Error:" + e);
}
- ```
## distributedData.createKVManager
@@ -61,21 +56,22 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
Creates a **KVManager** object to manage KV stores. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+**Parameters**
| Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ |
-| config |[KVManagerConfig](#kvmanager) | Yes| Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
+| config |[KVManagerConfig](#kvmanager) | Yes | Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
-- Return value
+**Return value**
| Type| Description|
| -------- | -------- |
| Promise<[KVManager](#kvmanager)> | Promise used to return the **KVManager** object created.|
-- Example
+**Example**
- ```
let kvManager;
try {
const kvManagerConfig = {
@@ -94,17 +90,18 @@ Creates a **KVManager** object to manage KV stores. This method uses a promise t
} catch (e) {
console.log("An unexpected error occurred. Error:" + e);
}
- ```
## KVManagerConfig
Provides configuration of the **KVManager** object, including the bundle name and user information of the caller.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
| Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ |
-| userInfo | [UserInfo](#userinfo) | Yes| User information.|
-| bundleName | string | Yes| Bundle name.|
+| userInfo | [UserInfo](#userinfo) | Yes | User information.|
+| bundleName | string | Yes | Bundle name.|
@@ -112,40 +109,48 @@ Provides configuration of the **KVManager** object, including the bundle name an
Defines user information.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
| Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ |
-| userId | string | Yes| User ID.|
-| userType | [UserType](#usertype) | Yes| User type.|
+| userId | string | Yes | User ID.|
+| userType | [UserType](#usertype) | Yes | User type.|
## UserType
Defines the user type.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
| Name| Default Value| Description|
| ----- | ------ | ------ |
-| SAME\_USER_ID| 0 | User who logs in to different devices using the same account.|
+| SAME_USER_ID | 0 | User who logs in to different devices using the same account.|
## KVManager
Creates a **KVManager** object to obtain KV store information. Before calling any method in **KVManager**, you must use **createKVManager** to create a **KVManager** object.
+
+
### getKVStore
-getKVStore(storeId: string, options: Options, callback: AsyncCallback<T>): void
+getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
Creates and obtains a KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+**Parameters**
| Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ |
-| storeId | string | Yes| Unique identifier of the KV store. The length cannot exceed [MAX\_STORE\_ID\_LENGTH](#constants).|
-| options | [Options](#options) | Yes| Configuration of the KV store.|
-| callback | AsyncCallback<T>, <T extends KVStore>| Yes| Callback invoked to return the KV store created.|
+| storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
+| options | [Options](#options) | Yes | Configuration of the KV store.|
+| callback | AsyncCallback<T>, <T extends KVStore>| Yes | Callback invoked to return the KV store created.|
-- Example
+**Example**
```
let kvStore;
@@ -179,22 +184,24 @@ getKVStore<T extends KVStore>(storeId: string, options: Options): Promise&
Creates and obtains a KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type | Mandatory | Description |
| ------- | ---------------------- | ---- | -------------------- |
-| storeId | string | Yes| Unique identifier of the KV store. The length cannot exceed [MAX\_STORE\_ID\_LENGTH](#constants).|
-| options | [Options](#options) | Yes| Configuration of the KV store.|
+| storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
+| options | [Options](#options) | Yes | Configuration of the KV store.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| -------------------------------------- | ------------------------ |
| Promise<T> <T extends KVStore> | Promise used to return the KV store created.|
-- Example
+**Example**
```
let kvStore;
@@ -221,22 +228,24 @@ Creates and obtains a KV store. This method uses a promise to return the result.
### closeKVStore8+ ###
-closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback<void>): void;
+closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback<void>): void
Closes a KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+**Parameters**
-| Name| Type| Mandatory| Description|
+
+| Name | Type | Mandatory| Description |
| ------- | ----------------- | ---- | --------------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
-| storeId | string | Yes| Unique identifier of the KV store to close. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).|
-| kvStore | [KVStore](#kvstore) | Yes| KV store to close.|
-| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned.|
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
+| storeId | string | Yes | Unique identifier of the KV store to close. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
+| kvStore | [KVStore](#kvstore) | Yes | KV store to close. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned. |
-- Example
+**Example**
```
let kvStore;
@@ -265,25 +274,27 @@ Closes a KV store. This method uses an asynchronous callback to return the resul
### closeKVStore8+ ###
-closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void>;
+closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void>
Closes a KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
-| storeId | string | Yes| Unique identifier of the KV store to close. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).|
-| kvStore | [KVStore](#kvstore) | Yes| KV store to close.|
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
+| storeId | string | Yes | Unique identifier of the KV store to close. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
+| kvStore | [KVStore](#kvstore) | Yes | KV store to close. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------------- | -------------- |
| Promise | Promise used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned.|
-- Example
+**Example**
```
let kvManager;
@@ -317,20 +328,22 @@ Closes a KV store. This method uses a promise to return the result.
### deleteKVStore8+ ###
-deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
+deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void
Deletes a KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
-| storeId | string | Yes| Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).|
-| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned.|
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
+| storeId | string | Yes | Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned. |
-- Example
+**Example**
```
let kvManager;
@@ -359,25 +372,27 @@ Deletes a KV store. This method uses an asynchronous callback to return the resu
### deleteKVStore8+ ###
-deleteKVStore(appId: string, storeId: string): Promise<void>;
+deleteKVStore(appId: string, storeId: string): Promise<void>
Deletes a KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
-| storeId | string | Yes| Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).|
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
+| storeId | string | Yes | Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------------- | -------------- |
| Promise<void> | Promise used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned.|
-- Example
+**Example**
```
let kvManager;
@@ -411,18 +426,20 @@ Deletes a KV store. This method uses a promise to return the result.
### getAllKVStoreId8+ ###
-getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void;
+getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void
Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
-| callback | AsyncCallback<void> | Yes|Callback used to return the KV store IDs obtained. |
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
+| callback | AsyncCallback<void> | Yes |Callback used to return the KV store IDs obtained. |
-- Example
+**Example**
```
let kvManager;
@@ -439,24 +456,26 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h
### getAllKVStoreId8+ ###
-getAllKVStoreId(appId: string): Promise<string[]>;
+getAllKVStoreId(appId: string): Promise<string[]>
Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| appId | string | Yes| Bundle name of the app that invokes the KV store.|
+| appId | string | Yes | Bundle name of the app that invokes the KV store. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------------- | -------------- |
| Promise<string[]>| Promise used to return the KV store IDs obtained.|
-- Example
+**Example**
```
let kvManager;
@@ -476,20 +495,22 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h
### on8+ ###
-on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void;
+on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void
Subscribes to the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| event | 'distributedDataServiceDie' | Yes| Type of events to subscribe to. |
-| deathCallback | Callback<void> | Yes| Callback invoked when the distributed data service is dead.|
+| event | 'distributedDataServiceDie' | Yes | Type of events to subscribe to. |
+| deathCallback | Callback<void> | Yes | Callback invoked when the distributed data service is dead. |
-- Example
+**Example**
```
let kvManager;
@@ -508,19 +529,21 @@ Subscribes to the **distributedDataServiceDie** events. This method uses a synch
### off8+ ###
-off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void;
+off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void
Unsubscribes from the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| event | 'distributedDataServiceDie' | Yes| Type of events to unsubscribe from. |
-| deathCallback | Callback<void> | No| Callback used to return the **distributedDataServiceDie** events.|
+| event | 'distributedDataServiceDie' | Yes | Type of events to unsubscribe from. |
+| deathCallback | Callback<void> | No | Callback used to return the **distributedDataServiceDie** events. |
-- Example
+**Example**
```
let kvManager;
@@ -540,25 +563,30 @@ Unsubscribes from the **distributedDataServiceDie** events. This method uses a s
Provides KV store configuration.
-| Name| Type| Mandatory| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created.|
-| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted.|
-| backup | boolean | No|Whether to back up database files. By default, database files are backed up. |
-| autoSync | boolean | No|Whether to automatically synchronize database files. By default, database files are not automatically synchronized.|
+| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created. |
+| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted. |
+| backup | boolean | No|Whether to back up database files. By default, database files are backed up. |
+| autoSync | boolean | No|Whether to automatically synchronize database files. By default, database files are not automatically synchronized. |
| kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.|
-| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set.|
+| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set. |
+| schema | [schema](#Schema8+) | No| Schema used to define the values stored in a KV store.|
## KVStoreType
Defines the KV store types.
-| Name| Default Value| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Default Value| Description |
| --- | ---- | ----------------------- |
-| DEVICE_COLLABORATION | 0 | Device KV store.|
-| SINGLE_VERSION | 1 | Single KV store.|
-| MULTI_VERSION | 2 | Multi-version KV store. This type is not supported currently.|
+| DEVICE_COLLABORATION | 0 | Device KV store. |
+| SINGLE_VERSION | 1 | Single KV store. |
+| MULTI_VERSION | 2 | Multi-version KV store. This type is not supported currently. |
@@ -566,83 +594,102 @@ Defines the KV store types.
Defines the KV store security levels.
-| Name| Default Value| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Default Value| Description |
| --- | ---- | ----------------------- |
-| NO_LEVEL | 0 | No security level is set for the KV store.|
-| S0 | 1 | The KV store security level is public.|
-| S1 | 2 | The KV store security level is low. If data leakage occurs, minor impact will be caused on the database.|
-| S2 | 3 | The KV store security level is medium. If data leakage occurs, moderate impact will be caused on the database.|
-| S3 | 5 | The KV store security level is high. If data leakage occurs, major impact will be caused on the database.|
-| S4 | 6 | The KV store security level is critical. If data leakage occurs, severe impact will be caused on the database.|
+| NO_LEVEL | 0 | No security level is set for the KV store. |
+| S0 | 1 | The KV store security level is public. |
+| S1 | 2 | The KV store security level is low. If data leakage occurs, minor impact will be caused on the database. |
+| S2 | 3 | The KV store security level is medium. If data leakage occurs, moderate impact will be caused on the database. |
+| S3 | 5 | The KV store security level is high. If data leakage occurs, major impact will be caused on the database. |
+| S4 | 6 | The KV store security level is critical. If data leakage occurs, severe impact will be caused on the database. |
## Constants
Defines the KV store constants.
-| Name| Default Value| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Default Value| Description |
| --- | ---- | ----------------------- |
-| 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\_KEY\_LENGTH\_DEVICE| 896 | Maximum length of the device coordinate key.|
-| MAX\_STORE\_ID\_LENGTH| 128 | Maximum length (in bytes) of a KV store ID.|
-| MAX\_QUERY_LENGTH| 512000 | Maximum query length.|
-| MAX\_BATCH_SIZE| 128 | Maximum size of a batch operation.|
+| 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_KEY_LENGTH_DEVICE | 896 | Maximum length of the device coordinate key. |
+| MAX_STORE_ID_LENGTH | 128 | Maximum length (in bytes) of a KV store ID. |
+| MAX_QUERY_LENGTH | 512000 | Maximum query length. |
+| MAX_BATCH_SIZE | 128 | Maximum size of a batch operation. |
## Schema8+ ##
Defines a database schema. When creating or opening a KV store, you can create a **Schema** object and put it into **Options**.
-### toJsonString8+ ###
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-toJsonString():string;
+| Name | Type| Description |
+| --- | ---- | ----------------------- |
+| root8+ | [FieldNode](#FieldNode) | JSON root object. |
+| indexes8+ | Array | String array in JSON format. |
+| mode8+ | number | Schema mode. |
+| skip8+ | number | Size of a skip of the schema. |
-Obtains the schema in JSON format.
+### constructor8+ ###
-- Return value
+constructor()
-| Type| Description|
-| ------------- | -------------- |
-| string |Schema in JSON format obtained.|
+A constructor used to create a **Schema** instance.
-- Example
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
- ```
- import ddm from '@ohos.data.distributedData';
- try {
- let schema = new ddm.Schema();
- const str = schema.toJsonString();
- console.log("schema: " + str);
- } catch (e) {
- console.log("toJsonString " + e);
- }
- ```
+## FieldNode8+ ##
+Represents a **Schema** instance, which provides the methods for defining the values stored in a KV store.
-## FieldNode8+ ##
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
+
+| Name | Type| Description |
+| --- | ---- | ----------------------- |
+| nullable8+ | boolean | Whether the database field can be null. |
+| default8+ | string | Default value of a **FieldNode**.|
+| type8+ | number | Value to store.|
+
+### constructor8+ ###
+
+constructor(name: string)
-Defines a node of a **Schema** instance. It provides methods for defining values stored in the KV store.
+A constructor used to create a **FieldNode** instance with a string field.
+
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
+
+**Parameters**
+
+| Name | Type| Mandatory | Description |
+| ----- | ------ | ---- | ----------------------- |
+| name | string | Yes | Value of **FieldNode**.
### appendChild8+ ###
-appendChild(child: FieldNode): boolean;
+appendChild(child: FieldNode): boolean
-Adds a child node to this **FieldNode**.
+Appends a child node to this **FieldNode**.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| child | [FieldNode](#FieldNode) | Yes| Child node to add.|
+| child | [FieldNode](#FieldNode) | Yes | Child node to append. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------------- | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
-- Example
+**Example**
```
import ddm from '@ohos.data.distributedData';
@@ -665,55 +712,33 @@ Adds a child node to this **FieldNode**.
```
-### toJson8+ ###
-
-toJson(): string;
-
-Obtains the field name.
-
-- Return value
-
-| Type| Description|
-| ------ | -------------- |
-| string |Field name obtained.|
-
-- Example
-
- ```
- import ddm from '@ohos.data.distributedData';
- try {
- let node = new ddm.FieldNode("root");
- let child = new ddm.FieldNode("child");
- node.appendChild(child);
- console.log("appendNode " + node.toJson());
- } catch (e) {
- console.log("ToJson " + e);
- }
- ```
## KvStoreResultSet8+ ##
Provides methods to obtain the KV store result set and query or move the data read position. Before calling any method in **KvStoreResultSet**, you must use **KvStore** to create a **KvStore** instance.
+
### getCount8+ ###
-getCount(): number;
+getCount(): number
Obtains the number of rows in the result set.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| number |Number of rows obtained.|
+| number |Number of rows obtained. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -730,22 +755,24 @@ Obtains the number of rows in the result set.
### getPosition8+ ###
-getPosition(): number;
+getPosition(): number
Obtains the current data read position (position from which data is read) in the result set.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| number |Current data read position obtained.|
+| number |Current data read position obtained. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -762,22 +789,24 @@ Obtains the current data read position (position from which data is read) in the
### moveToFirst8+ ###
-moveToFirst(): boolean;
+moveToFirst(): boolean
Moves the data read position to the first row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -794,22 +823,24 @@ Moves the data read position to the first row.
### moveToLast8+ ###
-moveToLast(): boolean;
+moveToLast(): boolean
Moves the data read position to the last row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -826,22 +857,24 @@ Moves the data read position to the last row.
### moveToNext8+ ###
-moveToNext(): boolean;
+moveToNext(): boolean
Moves the data read position to the next row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -858,22 +891,24 @@ Moves the data read position to the next row.
### moveToPrevious8+ ###
-moveToPrevious(): boolean;
+moveToPrevious(): boolean
Moves the data read position to the previous row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -890,28 +925,30 @@ Moves the data read position to the previous row.
### move8+ ###
-move(offset: number): boolean;
+move(offset: number): boolean
Moves the data read position with the specified offset from the current position.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| offset | number | Yes| Offset to move the data read position. A negative value means to move backward, and a positive value means to move forward.|
+| offset | number | Yes | Offset to move the data read position. A negative value means to move backward, and a positive value means to move forward. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -928,28 +965,30 @@ Moves the data read position with the specified offset from the current position
### moveToPosition8+ ###
-moveToPosition(position: number): boolean;
+moveToPosition(position: number): boolean
Moves the data read position from 0 to an absolute position.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| position | number | Yes|Absolute position to move to.|
+| position | number | Yes |Absolute position to move to. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
+| boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -966,22 +1005,24 @@ Moves the data read position from 0 to an absolute position.
### isFirst8+ ###
-isFirst(): boolean;
+isFirst(): boolean
Checks whether the data read position is the first row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the data read position is the first row; returns **false** otherwise.|
+| boolean |Returns **true** if the data read position is the first row; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -998,22 +1039,24 @@ Checks whether the data read position is the first row.
### isLast8+ ###
-isLast(): boolean;
+isLast(): boolean
Checks whether the data read position is the last row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the data read position is the last row; returns **false** otherwise.|
+| boolean |Returns **true** if the data read position is the last row; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -1030,22 +1073,24 @@ Checks whether the data read position is the last row.
### isBeforeFirst8+ ###
-isBeforeFirst(): boolean;
+isBeforeFirst(): boolean
Checks whether the data read position is before the first row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the read position is before the first row; returns **false** otherwise.|
+| boolean |Returns **true** if the read position is before the first row; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -1062,22 +1107,24 @@ Checks whether the data read position is before the first row.
### isAfterLast8+ ###
-isAfterLast(): boolean;
+isAfterLast(): boolean
Checks whether the data read position is after the last row.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | -------------- |
-| boolean |Returns **true** if the data read position is after the last row; returns **false** otherwise.|
+| boolean |Returns **true** if the data read position is after the last row; returns **false** otherwise. |
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -1094,22 +1141,24 @@ Checks whether the data read position is after the last row.
### getEntry8+ ###
-getEntry(): Entry;
+getEntry(): Entry
Obtains a KV pair.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
| Entry |KV pair obtained.|
-- Example
+**Example**
```
let kvStore;
try {
- let resultSet;
+ let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('getResultSet success');
resultSet = result;
@@ -1129,19 +1178,33 @@ Obtains a KV pair.
Provides methods to create a **Query** object, which defines different data query criteria.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+### constructor8+ ###
+
+constructor()
+
+A constructor used to create a **Schema** instance.
+
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+
### reset8+ ###
-reset(): Query;
+reset(): Query
Resets the **Query** object that contains common query options.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+
+**Return value**
+
+| Type | Description |
| ------ | ------- |
| [Query](#query8) |**Query** object reset.|
-- Example
+**Example**
```
try {
@@ -1163,20 +1226,22 @@ equalTo(field: string, value: number|string|boolean): Query;
Creates a **Query** object to match the specified field whose value is equal to the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| [Query](#query8) |**Query** object created.|
-- Example
+**Example**
```
try {
@@ -1192,24 +1257,26 @@ Creates a **Query** object to match the specified field whose value is equal to
### notEqualTo8+ ###
-notEqualTo(field: string, value: number|string|boolean): Query;
+notEqualTo(field: string, value: number|string|boolean): Query
Creates a **Query** object to match the specified field whose value is not equal to the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| [Query](#query8) |**Query** object created.|
-- Example
+**Example**
```
try {
@@ -1225,24 +1292,26 @@ Creates a **Query** object to match the specified field whose value is not equal
### greaterThan8+ ###
-greaterThan(field: string, value: number|string|boolean): Query;
+greaterThan(field: string, value: number|string|boolean): Query
Creates a **Query** object to match the specified field whose value is greater than the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1258,24 +1327,26 @@ Creates a **Query** object to match the specified field whose value is greater t
### lessThan8+ ###
-lessThan(field: string, value: number|string): Query;
+lessThan(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is less than the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1291,24 +1362,26 @@ Creates a **Query** object to match the specified field whose value is less than
### greaterThanOrEqualTo8+ ###
-greaterThanOrEqualTo(field: string, value: number|string): Query;
+greaterThanOrEqualTo(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is greater than or equal to the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1324,24 +1397,26 @@ Creates a **Query** object to match the specified field whose value is greater t
### lessThanOrEqualTo8+ ###
-lessThanOrEqualTo(field: string, value: number|string): Query;
+lessThanOrEqualTo(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is less than or equal to the specified value.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| value | number/string/boolean | Yes| Value specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| value | number/string/boolean | Yes | Value specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1357,23 +1432,26 @@ Creates a **Query** object to match the specified field whose value is less than
### isNull8+ ###
-isNull(field: string): Query;
+isNull(field: string): Query
Creates a **Query** object to match the specified field whose value is **null**.
-- Parameters
-| Name| Type| Mandatory| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1389,25 +1467,28 @@ Creates a **Query** object to match the specified field whose value is **null**.
### inNumber8+ ###
-inNumber(field: string, valueList: number[]): Query;
+inNumber(field: string, valueList: number[]): Query
Creates a **Query** object to match the specified field whose value is within the specified list of numbers.
-- Parameters
-| Name| Type| Mandatory| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | number[] | Yes| List of numbers.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | number[] | Yes | List of numbers.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1423,24 +1504,26 @@ Creates a **Query** object to match the specified field whose value is within th
### inString8+ ###
-inString(field: string, valueList: string[]): Query;
+inString(field: string, valueList: string[]): Query
Creates a **Query** object to match the specified field whose value is within the specified list of strings.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | string[] | Yes| List of strings.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | string[] | Yes | List of strings.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1456,24 +1539,26 @@ Creates a **Query** object to match the specified field whose value is within th
### notInNumber8+ ###
-notInNumber(field: string, valueList: number[]): Query;
+notInNumber(field: string, valueList: number[]): Query
Creates a **Query** object to match the specified field whose value is not within the specified list of numbers.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | number[] | Yes| List of numbers.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | number[] | Yes | List of numbers.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1489,24 +1574,26 @@ Creates a **Query** object to match the specified field whose value is not withi
### notInString8+ ###
-notInString(field: string, valueList: string[]): Query;
+notInString(field: string, valueList: string[]): Query
Creates a **Query** object to match the specified field whose value is not within the specified list of strings.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | string[] | Yes| List of strings.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | string[] | Yes | List of strings.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1522,24 +1609,26 @@ Creates a **Query** object to match the specified field whose value is not withi
### like8+ ###
-like(field: string, value: string): Query;
+like(field: string, value: string): Query
Creates a **Query** object to match the specified field whose value is similar to the specified string.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | string | Yes| String specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | string | Yes | String specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1555,24 +1644,26 @@ Creates a **Query** object to match the specified field whose value is similar t
### unlike8+ ###
-unlike(field: string, value: string): Query;
+unlike(field: string, value: string): Query
Creates a **Query** object to match the specified field whose value is not similar to the specified string.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
-| valueList | string | Yes| String specified.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
+| valueList | string | Yes | String specified.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1588,17 +1679,19 @@ Creates a **Query** object to match the specified field whose value is not simil
### and8+ ###
-and(): Query;
+and(): Query
Creates a **Query** object with the AND condition.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1616,17 +1709,19 @@ Creates a **Query** object with the AND condition.
### or8+ ###
-or(): Query;
+or(): Query
Creates a **Query** object with the OR condition.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1644,23 +1739,25 @@ Creates a **Query** object with the OR condition.
### orderByAsc8+ ###
-orderByAsc(field: string): Query;
+orderByAsc(field: string): Query
Creates a **Query** object to sort the query results in ascending order.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1677,24 +1774,26 @@ Creates a **Query** object to sort the query results in ascending order.
### orderByDesc8+ ###
-orderByDesc(field: string): Query;
+orderByDesc(field: string): Query
Creates a **Query** object to sort the query results in descending order.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.|
+| fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1711,24 +1810,26 @@ Creates a **Query** object to sort the query results in descending order.
### limit8+ ###
-limit(total: number, offset: number): Query;
+limit(total: number, offset: number): Query
Creates a **Query** object to specify the number of results and where to start.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| total | number | Yes|Number of results to query.|
-| offset | number | Yes|Start position for query.|
+| total | number | Yes |Number of results to query. |
+| offset | number | Yes |Start position for query. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1745,23 +1846,25 @@ Creates a **Query** object to specify the number of results and where to start.
### isNotNull8+ ###
-isNotNull(field: string): Query;
+isNotNull(field: string): Query
Creates a **Query** object with a specified field that is not null.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| fieId | string | Yes|Field specified.|
+| fieId | string | Yes |Field specified. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1777,17 +1880,19 @@ Creates a **Query** object with a specified field that is not null.
### beginGroup8+ ###
-beginGroup(): Query;
+beginGroup(): Query
Creates a **Query** object for a query condition group with a left parenthesis.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1805,17 +1910,19 @@ Creates a **Query** object for a query condition group with a left parenthesis.
### endGroup8+ ###
-endGroup(): Query;
+endGroup(): Query
Creates a **Query** object for a query condition group with a right parenthesis.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1833,23 +1940,25 @@ Creates a **Query** object for a query condition group with a right parenthesis.
### prefixKey8+ ###
-prefixKey(prefix: string): Query;
+prefixKey(prefix: string): Query
Creates a **Query** object with a specified key prefix.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| prefix | string | Yes|Key prefix.|
+| prefix | string | Yes |Key prefix. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1866,23 +1975,25 @@ Creates a **Query** object with a specified key prefix.
### setSuggestIndex8+ ###
-setSuggestIndex(index: string): Query;
+setSuggestIndex(index: string): Query
Creates a **Query** object with an index preferentially used for query.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| index | string | Yes|Index preferentially used for query.|
+| index | string | Yes |Index preferentially used for query. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1899,24 +2010,26 @@ Creates a **Query** object with an index preferentially used for query.
### deviceId8+ ###
-deviceId(deviceId:string):Query;
+deviceId(deviceId:string):Query
Creates a **Query** object with the device ID as the key prefix.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId | string | Yes|Device ID.|
+| deviceId | string | Yes |Device ID. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object created.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1931,17 +2044,19 @@ Creates a **Query** object with the device ID as the key prefix.
### getSqlLike8+ ###
-getSqlLike():string;
+getSqlLike():string
Obtains the query statement of this **Query** object.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
-| [Query](#query8) |**Query** object.|
+| [Query](#query8) |**Query** object Created.|
-- Example
+**Example**
```
try {
@@ -1958,21 +2073,25 @@ Obtains the query statement of this **Query** 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** to obtain a **KVStore** object.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
### put
put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void
Adds a KV pair of the specified type to this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
-| ----- | ------ | ---- | ----------------------- |
-| key | string | Yes|Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
-| value | Uint8Array / string / number / boolean | Yes|Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX\_VALUE\_LENGTH](#constants).|
+**Parameters**
+| Name | Type| Mandatory | Description |
+| ----- | ------ | ---- | ----------------------- |
+| key | string | Yes |Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
+| value | Uint8Array \| string \| number \| boolean | Yes |Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX_VALUE_LENGTH](#constants). |
+| callback | AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -1998,21 +2117,23 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise<void
Adds a KV pair of the specified type to this KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| key | string | Yes|Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
-| value | Uint8Array / string / number / boolean | Yes|Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX\_VALUE\_LENGTH](#constants).|
+| key | string | Yes |Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
+| value | Uint8Array \| string \| number \| boolean | Yes |Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX_VALUE_LENGTH](#constants). |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2036,14 +2157,16 @@ delete(key: string, callback: AsyncCallback<void>): void
Deletes a KV pair from this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| key | string | Yes|Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
-| callback | AsyncCallback<void> | Yes|Callback used to return the result.|
+| key | string | Yes |Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
+| callback | AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2076,19 +2199,21 @@ delete(key: string): Promise<void>
Deletes a KV pair from this KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| key | string | Yes|Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
+| key | string | Yes |Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2117,16 +2242,18 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific
Subscribes to data changes of the specified type. This method uses a synchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| event |'dataChange' | Yes|Type of the events to subscribe to.|
-| type |[SubscribeType](#subscribetype) | Yes|Type of data changes.|
-| observer |Callback<[ChangeNotification](#changenotification)> | Yes|Callback used to return the result.|
+| event |'dataChange' | Yes |Type of the events. |
+| type |[SubscribeType](#subscribetype) | Yes |Type of data changes. |
+| observer |Callback<[ChangeNotification](#changenotification)> | Yes |Callback invoked to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2138,19 +2265,21 @@ Subscribes to data changes of the specified type. This method uses a synchronous
### on
-on(event: 'syncComplete', syncCallback: Callback8+
-off(event:'dataChange', observer?: Callback<ChangeNotification>): void;
+off(event:'dataChange', observer?: Callback<ChangeNotification>): void
-Unsubscribes from data change events. This method uses a synchronouscallback to return the result.
+Unsubscribes from data change events. This method uses a synchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| event |'dataChange' | Yes|Type of the events to unsubscribe from.|
-| observer |Callback<[ChangeNotification](#changenotification)> |No|Callback used to return the result.|
+| event |'dataChange' | Yes |Type of the events. |
+| observer |Callback<[ChangeNotification](#changenotification)> |No |Callback used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2187,18 +2318,20 @@ Unsubscribes from data change events. This method uses a synchronouscallback to
### putBatch8+
-putBatch(entries: Entry[], callback: AsyncCallback<void>): void;
+putBatch(entries: Entry[], callback: AsyncCallback<void>): void
Inserts KV pairs in batches to this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| entries |[Entry](#entry)[] | Yes|KV pairs to insert in batches.|
-| callback |Asyncallback<void> |Yes|Callback used to return the result.|
+| entries |[Entry](#entry)[] | Yes |KV pairs to insert in batches. |
+| callback |Asyncallback<void> |Yes |Callback invoked to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2233,23 +2366,25 @@ Inserts KV pairs in batches to this KV store. This method uses an asynchronous c
### putBatch8+
-putBatch(entries: Entry[]): Promise<void>;
+putBatch(entries: Entry[]): Promise<void>
Inserts KV pairs in batches to this KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| entries |[Entry](#entry)[] | Yes|KV pairs to insert in batches.|
+| entries |[Entry](#entry)[] | Yes |KV pairs to insert in batches. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2286,18 +2421,20 @@ Inserts KV pairs in batches to this KV store. This method uses a promise to retu
### deleteBatch8+
-deleteBatch(keys: string[], callback: AsyncCallback<void>): void;
+deleteBatch(keys: string[], callback: AsyncCallback<void>): void
Deletes KV pairs in batches from this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keys |string[] | Yes|KV pairs to delete in batches.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| keys |string[] | Yes |KV pairs to delete in batches. |
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2331,23 +2468,25 @@ Deletes KV pairs in batches from this KV store. This method uses an asynchronous
### deleteBatch8+ ###
-deleteBatch(keys: string[]): Promise<void>;
+deleteBatch(keys: string[]): Promise<void>
Deletes KV pairs in batches from this KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keys |string[] | Yes|KV pairs to delete in batches.|
+| keys |string[] | Yes |KV pairs to delete in batches. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2385,17 +2524,19 @@ Deletes KV pairs in batches from this KV store. This method uses a promise to re
### startTransaction8+ ###
-startTransaction(callback: AsyncCallback<void>): void;
+startTransaction(callback: AsyncCallback<void>): void
Starts the transaction in this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2435,17 +2576,19 @@ Starts the transaction in this KV store. This method uses an asynchronous callba
### startTransaction8+ ###
-startTransaction(): Promise<void>;
+startTransaction(): Promise<void>
Starts the transaction in this KV store. This method uses a promise to return the result.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2468,17 +2611,19 @@ Starts the transaction in this KV store. This method uses a promise to return th
### commit8+ ###
-commit(callback: AsyncCallback<void>): void;
+commit(callback: AsyncCallback<void>): void
Commits the transaction in this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2498,17 +2643,19 @@ Commits the transaction in this KV store. This method uses an asynchronous callb
### commit8+ ###
-commit(): Promise<void>;
+commit(): Promise<void>
Commits the transaction in this KV store. This method uses a promise to return the result.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2526,17 +2673,19 @@ Commits the transaction in this KV store. This method uses a promise to return t
### rollback8+ ###
-rollback(callback: AsyncCallback<void>): void;
+rollback(callback: AsyncCallback<void>): void
Rolls back the transaction in this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2556,17 +2705,19 @@ Rolls back the transaction in this KV store. This method uses an asynchronous ca
### rollback8+ ###
-rollback(): Promise<void>;
+rollback(): Promise<void>
Rolls back the transaction in this KV store. This method uses a promise to return the result.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2584,18 +2735,20 @@ Rolls back the transaction in this KV store. This method uses a promise to retur
### enableSync8+ ###
-enableSync(enabled: boolean, callback: AsyncCallback<void>): void;
+enableSync(enabled: boolean, callback: AsyncCallback<void>): void
Sets data synchronization, which can be enabled or disable. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| enabled |boolean | Yes|Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| enabled |boolean | Yes |Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite. |
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2615,23 +2768,25 @@ Sets data synchronization, which can be enabled or disable. This method uses an
### enableSync8+ ###
-enableSync(enabled: boolean): Promise<void>;
+enableSync(enabled: boolean): Promise<void>
-Sets data synchronization, which can be enabled or disable. This method uses a promise to return the result.
+Enables or disables data synchronization. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| enabled |boolean | Yes|Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite.|
+| enabled |boolean | Yes |Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2649,19 +2804,21 @@ Sets data synchronization, which can be enabled or disable. This method uses a p
### setSyncRange8+ ###
-setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void;
+setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void
Sets the data synchronization range. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| localLabels |string[] | Yes|Synchronization labels set for the local device.|
-| remoteSupportLabels |string[] | Yes|Synchronization labels set for remote devices.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| localLabels |string[] | Yes |Synchronization labels set for the local device. |
+| remoteSupportLabels |string[] | Yes |Synchronization labels set for remote devices. |
+| callback |AsyncCallback<void> | Yes |Callback invoked to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -2679,25 +2836,27 @@ Sets the data synchronization range. This method uses an asynchronous callback t
### setSyncRange8+ ###
-setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>;
+setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>
Sets the data synchronization range. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| localLabels |string[] | Yes|Synchronization labels set for the local device.|
-| remoteSupportLabels |string[] | Yes|Synchronization labels set for remote devices.|
+| localLabels |string[] | Yes |Synchronization labels set for the local device. |
+| remoteSupportLabels |string[] | Yes |Synchronization labels set for remote devices. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
| Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -2719,41 +2878,49 @@ Sets the data synchronization range. This method uses a promise to return the re
Defines the subscription type.
-| Name| Default Value| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Default Value | Description |
| ----- | ------ | ----------------------- |
-| SUBSCRIBE_TYPE_LOCAL |0 |Local data changes.|
-| SUBSCRIBE_TYPE_REMOTE |1 |Remote data changes.|
-| SUBSCRIBE_TYPE_ALL |2 |Local and remote data changes.|
+| SUBSCRIBE_TYPE_LOCAL |0 |Local data changes. |
+| SUBSCRIBE_TYPE_REMOTE |1 |Remote data changes. |
+| SUBSCRIBE_TYPE_ALL |2 |Local and remote data changes. |
## ChangeNotification
Defines the content of data change notifications, including inserted data, updated data, deleted data, and device ID.
-| Name| Type|Readable|Writable| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ |
-| insertEntries | [Entry](#entry)[] | Yes| Yes|Data inserted.|
-| updateEntries | [Entry](#entry)[] | Yes| Yes|Data updated.|
-| deleteEntries | [Entry](#entry)[] | Yes| Yes|Data deleted.|
-| deviceId | string | Yes| Yes|UUID of the device.|
+| insertEntries | [Entry](#entry)[] | Yes | Yes|Data inserted. |
+| updateEntries | [Entry](#entry)[] | Yes | Yes|Data updated. |
+| deleteEntries | [Entry](#entry)[] | Yes | Yes|Data deleted. |
+| deviceId | string | Yes | Yes|UUID of the device. |
## Entry
Defines the KV pairs stored in the KV store.
-| Name| Type|Readable|Writable| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ |
-| key | string | Yes| Yes|Key of the KV pair stored in the KV store.|
-| value | [Value](#value) | Yes| Yes|Value of the KV pair stored in the KV store.|
+| key | string | Yes | Yes|Key of the KV pair stored in the KV store. |
+| value | [Value](#value) | Yes | Yes|Value of the KV pair stored in the KV store. |
## Value
Defines the value in a KV pair.
-| Name| Type|Readable|Writable| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ |
-| type | [ValueType](#value) | Yes| Yes|Type of the value.|
-| value | Uint8Array / string / number / boolean| Yes| Yes|Specific value.|
+| type | [ValueType](#value) | Yes | Yes|Type of the value. |
+| value | Uint8Array / string / number / boolean| Yes | Yes|Value of the KV pair stored in the KV store. |
## ValueType
@@ -2761,33 +2928,39 @@ Enumerates the types of values in KV pairs.
These value types can be used only by internal applications.
-| Name| Default Value| Description|
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
+| Name | Default Value | Description |
| ----- | ------ | ----------------------- |
-| STRING |0 |String.|
-| INTEGER |1 |Integer.|
-| FLOAT |2 |Float (single-precision floating point).|
-| BYTE_ARRAY |3 |Byte array.|
-| BOOLEAN |4 |Boolean.|
-| DOUBLE |5 |Double (double-precision floating point).|
+| STRING |0 |String. |
+| INTEGER |1 |Integer. |
+| FLOAT |2 |Float (single-precision floating point). |
+| BYTE_ARRAY |3 |Byte array. |
+| BOOLEAN |4 |Boolean. |
+| DOUBLE |5 |Double (double-precision floating point). |
## SingleKVStore
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** to obtain a **SingleKVStore** object.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
+
### get
get(key: string, callback: AsyncCallback<Uint8Array | string | boolean | number>): void
Obtains the value of a specified key. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| key |string | Yes|Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
-| callback |AsyncCallback<Uint8Array / string / boolean / number>) | Yes|Callback used to return the value obtained.|
+| key |string | Yes |Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
+| callback |AsyncCallback<Uint8Array / string / boolean / number>) | Yes |Callback used to return the value obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -2812,25 +2985,27 @@ Obtains the value of a specified key. This method uses an asynchronous callback
### get
-get(key: string): Promise<Uint8Array | string | boolean | number>
+get(key: string): Promise<Uint8Array | string | boolean | number>
Obtains the value of a specified key. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| key |string | Yes|Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
+| key |string | Yes |Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<Uint8Array / string / boolean / number> |Promise used to return the value obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -2854,18 +3029,20 @@ Obtains the value of a specified key. This method uses a promise to return the r
### getEntries8+ ###
-getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
+getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void
Obtains the KV pairs that match the specified key prefix. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keyPrefix |string | Yes|Key prefix to match.|
-| callback |AsyncCallback<Entry[]> | Yes|Callback used to return the KV pairs obtained.|
+| keyPrefix |string | Yes |Key prefix to match. |
+| callback |AsyncCallback<Entry[]> | Yes |Callback used to return the KV pairs obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -2898,23 +3075,25 @@ Obtains the KV pairs that match the specified key prefix. This method uses an as
### getEntries8+ ###
-getEntries(keyPrefix: string): Promise<Entry[]>;
+getEntries(keyPrefix: string): Promise<Entry[]>
Obtains the KV pairs that match the specified key prefix. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keyPrefix |string | Yes|Key prefix to match.|
+| keyPrefix |string | Yes |Key prefix to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -2954,18 +3133,20 @@ Obtains the KV pairs that match the specified key prefix. This method uses a pro
### getEntries8+ ###
-getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
+getEntries(query: Query, callback: AsyncCallback<Entry[]>): void
Obtains the KV pairs that match the specified **Query** object. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<Entry[]> | Yes|Callback used to return the KV pairs obtained.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<Entry[]> | Yes |Callback used to return the KV pairs obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3003,23 +3184,25 @@ Obtains the KV pairs that match the specified **Query** object. This method uses
### getEntries8+ ###
-getEntries(query: Query): Promise<Entry[]>;
+getEntries(query: Query): Promise<Entry[]>
Obtains the KV pairs that match the specified **Query** object. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
-- Example
+**Example**
```
try {
@@ -3058,18 +3241,20 @@ Obtains the KV pairs that match the specified **Query** object. This method uses
### getResultSet8+ ###
-getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void;
+getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void
Obtains the result set with the specified key prefix from this single KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keyPrefix |string | Yes|Key prefix to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes|Callback used to return the result set obtained.|
+| keyPrefix |string | Yes |Key prefix to match.|
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback used to return the result set obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3105,23 +3290,25 @@ Obtains the result set with the specified key prefix from this single KV store.
### getResultSet8+ ###
-getResultSet(keyPrefix: string): Promise<KvStoreResultSet>;
+getResultSet(keyPrefix: string): Promise<KvStoreResultSet>
Obtains the result set with the specified key prefix from this single KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| keyPrefix |string | Yes|Key prefix to match.|
+| keyPrefix |string | Yes |Key prefix to match.|
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the result set obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3163,18 +3350,20 @@ Obtains the result set with the specified key prefix from this single KV store.
### getResultSet8+ ###
-getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void;
+getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |Query | Yes|**Query** object to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes|Callback used to return the **KvStoreResultSet** object obtained.|
+| query |Query | Yes |**Query** object to match. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback used to return the **KvStoreResultSet** object obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3209,23 +3398,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet8+ ###
-getResultSet(query: Query): Promise<KvStoreResultSet>;
+getResultSet(query: Query): Promise<KvStoreResultSet>
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3261,20 +3452,23 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
}
```
+
### closeResultSet8+ ###
-closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void;
+closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes|**KvStoreResultSet** object to close.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the execution result.|
+| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes |**KvStoreResultSet** object to close. |
+| callback |AsyncCallback<void> | Yes |Callback used to return the execution result. |
-- Example
+**Example**
```
let kvStore;
@@ -3295,23 +3489,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### closeResultSet8+ ###
-closeResultSet(resultSet: KvStoreResultSet): Promise<void>;
+closeResultSet(resultSet: KvStoreResultSet): Promise<void>
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes|**KvStoreResultSet** object to close.|
+| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes |**KvStoreResultSet** object to close. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -3330,18 +3526,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### getResultSize8+ ###
-getResultSize(query: Query, callback: AsyncCallback<number>): void;
+getResultSize(query: Query, callback: AsyncCallback<number>): void
+
+Obtains the number of results that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
-Obtains the number of results matching the specified **Query** object. This method uses an asynchronous callback to return the result.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-- Parameters
+**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<number> | Yes|Callback used to return the number of results obtained.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<number> | Yes |Callback used to return the number of results obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3374,23 +3572,25 @@ Obtains the number of results matching the specified **Query** object. This meth
### getResultSize8+ ###
-getResultSize(query: Query): Promise<number>;
+getResultSize(query: Query): Promise<number>
+
+Obtains the number of results that matches the specified **Query** object. This method uses a promise to return the result.
-Obtains the number of results matching the specified **Query** object. This method uses a promise to return the result.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-- Parameters
+**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<number> |Promise used to return the number of results obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3427,18 +3627,20 @@ Obtains the number of results matching the specified **Query** object. This meth
### removeDeviceData8+ ###
-removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
+removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void
Deletes data of a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| deviceId |string | Yes |ID of the target device. |
+| callback |AsyncCallback<void> | Yes |Callback used to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -3467,23 +3669,25 @@ Deletes data of a device. This method uses an asynchronous callback to return th
### removeDeviceData8+ ###
-removeDeviceData(deviceId: string): Promise<void>;
+removeDeviceData(deviceId: string): Promise<void>
Deletes data of a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
+| deviceId |string | Yes |ID of the target device. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -3514,18 +3718,20 @@ Deletes data of a device. This method uses a promise to return the result.
### on8+ ###
-on(event: 'syncComplete', syncCallback: Callback8+ ###
-off(event: 'syncComplete', syncCallback?: Callback8+ ###
-setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void;
+setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void
Sets the default delay of database synchronization. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| defaultAllowedDelayMs |number | Yes|Default delay allowed for database synchronization, in ms.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| defaultAllowedDelayMs |number | Yes |Default delay allowed for database synchronization, in ms. |
+| callback |AsyncCallback<void> | Yes |Callback used to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -3628,24 +3840,26 @@ Sets the default delay of database synchronization. This method uses an asynchro
### setSyncParam8+ ###
-setSyncParam(defaultAllowedDelayMs: number): Promise<void>;
+setSyncParam(defaultAllowedDelayMs: number): Promise<void>
Sets the default delay of database synchronization. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| defaultAllowedDelayMs |number | Yes|Default delay allowed for database synchronization, in ms.|
+| defaultAllowedDelayMs |number | Yes |Default delay allowed for database synchronization, in ms. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -3664,17 +3878,19 @@ Sets the default delay of database synchronization. This method uses a promise t
### getSecurityLevel8+ ###
-getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void;
+getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void
Obtains the security level of this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes|Callback used to return the security level obtained.|
+| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes |Callback used to return the security level obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3690,18 +3906,20 @@ Obtains the security level of this KV store. This method uses an asynchronous ca
### getSecurityLevel8+ ###
-getSecurityLevel(): Promise<SecurityLevel>;
+getSecurityLevel(): Promise<SecurityLevel>
Obtains the security level of this KV store. This method uses a promise to return the result.
-- Return value
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Type| Description|
+**Return value**
+
+| Type | Description |
| ------ | ------- |
|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3721,22 +3939,26 @@ Obtains the security level of this KV store. This method uses a promise to retur
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** to obtain a **DeviceKVStore** object.
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
+
### get8+ ###
-get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|number|Uint8Array>): void;
+get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|number|Uint8Array>): void
Obtains the string value that matches the specified key for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| key |string | Yes|Key to match.|
-| callback |AsyncCallback<boolean/string/number/Uint8Array> | Yes|Callback used to return the value obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| key |string | Yes |Key to match. |
+| callback |AsyncCallback<boolean/string/number/Uint8Array> | Yes |Callback used to return the value obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3757,24 +3979,26 @@ Obtains the string value that matches the specified key for a device. This metho
### get8+ ###
-get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array>;
+get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array>
Obtains the string value that matches the specified key for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| key |string | Yes|Key to match.|
+| deviceId |string | Yes |ID of the target device. |
+| key |string | Yes |Key to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<boolean/string/number/Uint8Array> |Promise used to return the value obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3799,19 +4023,21 @@ Obtains the string value that matches the specified key for a device. This metho
### getEntries8+ ###
-getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
+getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void
Obtains the KV pairs that match the specified key prefix for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| keyPrefix |string | Yes|Key prefix to match.|
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes|Callback used to return the KV pairs obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| keyPrefix |string | Yes |Key prefix to match. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback used to return the KV pairs obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3845,24 +4071,26 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth
### getEntries8+ ###
-getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>;
+getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>
Obtains the KV pairs that match the specified key prefix for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| keyPrefix |string | Yes|Key prefix to match.|
+| deviceId |string | Yes |ID of the target device. |
+| keyPrefix |string | Yes |Key prefix to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -3902,18 +4130,20 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth
### getEntries8+ ###
-getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
+getEntries(query: Query, callback: AsyncCallback<Entry[]>): void
-Obtains the KV pairs matching the specified **Query** object. This method uses an asynchronous callback to return the result.
+Obtains the KV pairs that match the specified **Query** object. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes|Callback used to return the KV pairs obtained.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback used to return the KV pairs obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -3953,23 +4183,25 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a
### getEntries8+ ###
-getEntries(query: Query): Promise<Entry[]>;
+getEntries(query: Query): Promise<Entry[]>
-Obtains the KV pairs matching the specified **Query** object. This method uses a promise to return the result.
+Obtains the KV pairs that match the specified **Query** object. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4009,19 +4241,21 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a
### getEntries8+ ###
-getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void;
+getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void
-Obtains the KV pairs matching the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
+Obtains the KV pairs that match the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes|Callback used to return the KV pairs obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback used to return the KV pairs obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4061,24 +4295,26 @@ Obtains the KV pairs matching the specified **Query** object for a device. This
### getEntries8+ ###
-getEntries(deviceId: string, query: Query): Promise<Entry[]>;
+getEntries(deviceId: string, query: Query): Promise<Entry[]>
-Obtains the KV pairs matching the specified **Query** object for a device. This method uses a promise to return the result.
+Obtains the KV pairs that match the specified **Query** object for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4119,19 +4355,21 @@ Obtains the KV pairs matching the specified **Query** object for a device. This
### getResultSet8+ ###
-getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void;
+getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void
Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| keyPrefix |string | Yes|Key prefix to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes|Callback used to return the **KvStoreResultSet** object obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| keyPrefix |string | Yes |Key prefix to match. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4152,24 +4390,26 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo
### getResultSet8+ ###
-getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet>;
+getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet>
Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| keyPrefix |string | Yes|Key prefix to match.|
+| deviceId |string | Yes |ID of the target device. |
+| keyPrefix |string | Yes |Key prefix to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[KvStoreResultSet](#kvstoreresultset8)[]> |Promise used to return the **KvStoreResultSet** object obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4194,18 +4434,20 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo
### getResultSet8+ ###
-getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void;
+getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes|Callback used to return the **KvStoreResultSet** object obtained.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4244,23 +4486,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet8+ ###
-getResultSet(query: Query): Promise<KvStoreResultSet>;
+getResultSet(query: Query): Promise<KvStoreResultSet>
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[KvStoreResultSet](#kvstoreresultset8)[]> |Promise used to return the **KvStoreResultSet** object obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4306,19 +4550,21 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet8+ ###
-getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreResultSet>): void;
+getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreResultSet>): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes|Callback used to return the **KvStoreResultSet** object obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)[]> | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4356,24 +4602,26 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet8+ ###
-getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>;
+getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>
Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<[KvStoreResultSet](#kvstoreresultset8)[]> |Promise used to return the **KvStoreResultSet** object obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4420,18 +4668,20 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### closeResultSet8+ ###
-closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void;
+closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| resultSet |[KvStoreResultSet](#getresultset8) | Yes|**KvStoreResultSet** object to close.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| resultSet |[KvStoreResultSet](#getresultset8) | Yes |**KvStoreResultSet** object to close. |
+| callback |AsyncCallback<void> | Yes |Callback used to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -4453,23 +4703,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### closeResultSet8+ ###
-closeResultSet(resultSet: KvStoreResultSet): Promise<void>;
+closeResultSet(resultSet: KvStoreResultSet): Promise<void>
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| resultSet |[KvStoreResultSet](#getresultset8) | Yes|**KvStoreResultSet** object to close.|
+| resultSet |[KvStoreResultSet](#getresultset8) | Yes |**KvStoreResultSet** object to close. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -4489,18 +4741,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### getResultSize8+ ###
-getResultSize(query: Query, callback: AsyncCallback<number>): void;
+getResultSize(query: Query, callback: AsyncCallback<number>): void
Obtains the number of results that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<number> | Yes|Callback used to return the number of results obtained.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<number> | Yes |Callback used to return the number of results obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4534,23 +4788,25 @@ Obtains the number of results that matches the specified **Query** object. This
### getResultSize8+ ###
-getResultSize(query: Query): Promise<number>;
+getResultSize(query: Query): Promise<number>
Obtains the number of results that matches the specified **Query** object. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<number> |Promise used to return the number of results obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4592,15 +4848,17 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number&
Obtains the number of results that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
-| callback |AsyncCallback<number> | Yes|Callback used to return the number of results obtained.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
+| callback |AsyncCallback<number> | Yes |Callback used to return the number of results obtained. |
-- Example
+**Example**
```
let kvStore;
@@ -4633,24 +4891,26 @@ Obtains the number of results that matches the specified **Query** object for a
### getResultSize8+ ###
-getResultSize(deviceId: string, query: Query): Promise<number>;
+getResultSize(deviceId: string, query: Query): Promise<number>
Obtains the number of results that matches the specified **Query** object for a device. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| query |[Query](#query8) | Yes|**Query** object to match.|
+| deviceId |string | Yes |ID of the target device. |
+| query |[Query](#query8) | Yes |**Query** object to match. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<number> |Promise used to return the number of results obtained.|
-- Example
+**Example**
```
let kvStore;
@@ -4687,18 +4947,20 @@ Obtains the number of results that matches the specified **Query** object for a
### removeDeviceData8+ ###
-removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
+removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void
Removes data of a device from this KV store. This method uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
-| callback |AsyncCallback<void> | Yes|Callback used to return the result.|
+| deviceId |string | Yes |ID of the target device. |
+| callback |AsyncCallback<void> | Yes |Callback used to return the result. |
-- Example
+**Example**
```
let kvStore;
@@ -4727,23 +4989,25 @@ Removes data of a device from this KV store. This method uses an asynchronous ca
### removeDeviceData8+ ###
-removeDeviceData(deviceId: string): Promise<void>;
+removeDeviceData(deviceId: string): Promise<void>
Removes data of a device from this KV store. This method uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceId |string | Yes|ID of the target device.|
+| deviceId |string | Yes |ID of the target device. |
-- Return value
+**Return value**
-| Type| Description|
+| Type | Description |
| ------ | ------- |
|Promise<void> |Promise used to return the result.|
-- Example
+**Example**
```
let kvStore;
@@ -4774,20 +5038,22 @@ Removes data of a device from this KV store. This method uses a promise to retur
### sync8+ ###
-sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void;
+sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
Manually triggers KV store synchronization synchronously.
-- Parameters
+**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name| Type| Mandatory| Description|
+**Parameters**
+
+| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| deviceIdList |string[] | Yes|IDs of the devices to be synchronized.|
-| mode |[SyncMode](#syncmode) | Yes|Data synchronization mode, which can be **PUSH**, **PULL**, or **PUSH_PULL**.|
-| allowedDelayMs |number | No|Allowed synchronization delay time, in ms.|
+| deviceIdList |string[] | Yes |IDs of the devices to be synchronized.|
+| mode |[SyncMode](#syncmode) | Yes |Data synchronization mode, which can be **PUSH**, **PULL**, or **PUSH_PULL**. |
+| allowedDelayMs |number | No |Allowed synchronization delay time, in ms. |
-- Example
+**Example**
```
let kvStore;
@@ -4810,18 +5076,20 @@ Manually triggers KV store synchronization synchronously.
### on8+ ###
-on(event: 'syncComplete', syncCallback: Callback8+ ###
-off(event: 'syncComplete', syncCallback?: Callback