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 first matching record, or null if not found
Throws
If shard not found or query fails
Example
// Administrative query: get a specific user from a shard constuser = awaitfirstShard('db-east', 'SELECT * FROM users WHERE id = ?', ['user-123']); if (user) { console.log(`Found user: ${user.name}`); } else { console.log('User not found in east shard'); }
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.