@textile/hub > Client > has
Client.has() method
Check if a given instance exists in the collection.
Signature:
has(threadID: ThreadID, collectionName: string, IDs: string[]): Promise<boolean>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| threadID | ThreadID | the ID of the database |
| collectionName | string | The human-readable name of the model to use. |
| IDs | string[] | An array of instance ids to check for. |
Returns:
Promise<boolean>
Example
Check if an instance exists
import {Client, ThreadID, Where} from '@textile/hub'
async function instanceExists (client: Client, threadID: ThreadID, id: string) {
return await client.has(threadID, 'astronauts', [id])
}