This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Description
lib/moped/bson.rb specifies the ways in which BSON fields are packed, but they currently use native endianness, which leads to errors on a big-endian system because the encoding for BSON fields are in little-endian byte order. The following patch fixes the problem.
diff --git a/lib/moped/bson.rb b/lib/moped/bson.rb
index 2136aa2..5aca1c1 100644
--- a/lib/moped/bson.rb
+++ b/lib/moped/bson.rb
@@ -16,8 +16,8 @@ module Moped
EOD = NULL_BYTE = "\u0000".freeze
- INT32_PACK = 'l'.freeze
- INT64_PACK = 'q'.freeze
+ INT32_PACK = "l<".freeze
+ INT64_PACK = 'q<'.freeze
FLOAT_PACK = 'E'.freeze
START_LENGTH = [0].pack(INT32_PACK).freeze