Bypasses the normal routing logic to execute a query directly on a specified
shard. This is useful for administrative operations, cross-shard queries,
or when you need to query data that doesn't follow the primary key routing pattern.
Use with caution: This function bypasses routing safeguards and should
be used only when you specifically need to target a particular shard.
Promise resolving to the result of the query execution
Throws
If shard not found or query fails
Example
// Administrative query: insert a new user directly into a specific shard constresult = awaitrunShard('db-east', 'INSERT INTO users (id, name, email) VALUES (?, ?, ?)', ['user-789', 'Alice', 'alice@example.com'] ); console.log(`Inserted user with ID: ${result.lastInsertId}`);
Bypasses the normal routing logic to execute a query directly on a specified shard. This is useful for administrative operations, cross-shard queries, or when you need to query data that doesn't follow the primary key routing pattern.
Use with caution: This function bypasses routing safeguards and should be used only when you specifically need to target a particular shard.