@textile/hub > Client > updateCollection
Client.updateCollection() method
updateCollection updates an existing collection. Currently, updates can include name and schema. Allow update of indexing information.
Signature:
updateCollection(threadID: ThreadID, config: CollectionConfig): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
threadID | ThreadID | the ID of the database |
config | CollectionConfig | A configuration object for the collection. See CollectionConfig. |
Returns:
Promise<void>
Example
Change the name of our astronauts collection
import {Client, ThreadID} from '@textile/hub'
const astronauts = {
title: "Astronauts",
type: "object",
required: ["_id"],
properties: {
_id: {
type: "string",
description: "The instance's id.",
},
name: {
type: "string",
description: "The astronauts name.",
},
missions: {
description: "The number of missions.",
type: "integer",
minimum: 0,
},
},
}
async function changeName (client: Client, threadID: ThreadID) {
return await client.updateCollection(threadID, { name: 'toy-story-characters', schema: astronauts })
}