diff --git a/src/commands.zig b/src/commands.zig index 2bdd392..75ee4d5 100644 --- a/src/commands.zig +++ b/src/commands.zig @@ -3157,13 +3157,13 @@ fn run_for_code(ctx: *Context, name: []const u8, value: bson.Value, extra: []con return null; } -fn doc_count(ctx: *Context, coll: []const u8) !i64 { +fn doc_count(ctx: *Context, coll: []const u8) !i32 { var reply = wire.Reply.init(testing.allocator); defer reply.deinit(); var msg = try parse_fake_msg("count", .{ .string = coll }, &.{}); defer msg.deinit(); try dispatch(ctx, &msg, &reply); - return bson.get_pair(reply.pairs.items, "n").?.int64; + return bson.get_pair(reply.pairs.items, "n").?.int32; } test "a well-formed session id changes nothing and is not echoed" { @@ -3191,7 +3191,7 @@ test "a well-formed session id changes nothing and is not echoed" { // mongod answers a well-formed lsid with exactly `{ok: 1}` and no echo, // measured; a driver reads only `$clusterTime` and `operationTime` back. try testing.expect(bson.get_pair(reply.pairs.items, "lsid") == null); - try testing.expectEqual(@as(i64, 1), try doc_count(&ctx, "sess")); + try testing.expectEqual(@as(i32, 1), try doc_count(&ctx, "sess")); } test "a malformed session id is refused without leaking a lock" { @@ -3271,7 +3271,7 @@ test "a transactional write is refused rather than applied" { .{ .key = "startTransaction", .value = .{ .bool = true } }, .{ .key = "autocommit", .value = .{ .bool = false } }, })).?); - try testing.expectEqual(@as(i64, 0), try doc_count(&ctx, "txn")); + try testing.expectEqual(@as(i32, 0), try doc_count(&ctx, "txn")); // The order the checks fire in is mongod's, measured: a missing session id // is reported before the standalone refusal, and a bad type before both. @@ -3289,7 +3289,7 @@ test "a transactional write is refused rather than applied" { .{ .key = "lsid", .value = lsid }, .{ .key = "startTransaction", .value = .{ .bool = true } }, })).?); - try testing.expectEqual(@as(i64, 0), try doc_count(&ctx, "txn")); + try testing.expectEqual(@as(i32, 0), try doc_count(&ctx, "txn")); } test "endSessions judges the array it is handed" {