Files
smartdb/rust/crates/rustdb-commands/src/handlers/hello_handler.rs
T

29 lines
797 B
Rust

use bson::{doc, Document};
use crate::context::CommandContext;
use crate::error::CommandResult;
/// Handle `hello`, `ismaster`, and `isMaster` commands.
///
/// Returns server capabilities matching wire protocol expectations.
pub async fn handle(
_cmd: &Document,
_db: &str,
_ctx: &CommandContext,
) -> CommandResult<Document> {
Ok(doc! {
"ismaster": true,
"isWritablePrimary": true,
"maxBsonObjectSize": 16_777_216_i32,
"maxMessageSizeBytes": 48_000_000_i32,
"maxWriteBatchSize": 100_000_i32,
"localTime": bson::DateTime::now(),
"logicalSessionTimeoutMinutes": 30_i32,
"connectionId": 1_i32,
"minWireVersion": 0_i32,
"maxWireVersion": 21_i32,
"readOnly": false,
"ok": 1.0,
})
}