fork - Fork a collection
The fork() method is used to create a new collection with the same data as the specified collection.
info
- In seekdb V1.1.0,
FORK TABLEis provided as an experimental feature and is not recommended for production use. - This API can only be used when connected with
SeekdbClient. For more information aboutSeekdbClient, see SeekdbClient.
Prerequisites
-
You have installed seekdb-js. For more information, see Quick start.
-
You have installed the server mode of seekdb. For more information, see Deploy seekdb by using yum install.
-
You are connected to the database. For more information, see SeekdbClient.
-
The collection to be forked exists. If the collection does not exist, an error will be returned.
Request parameters
fork("forkCollection");
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
name | string | string[] | Yes | The name of the new collection. | fork_collection |
Request example
import { SeekdbClient } from "seekdb";
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});
const collection = await client.getCollection({name: 'my_collection'});
const forkCollection = await collection.fork('fork_collection');
Response parameters
Returns a forked collection.