我正在尝试将从Mongo读取的BSONDocument发布到AWS Kinesis流中。但是,Kinesis API需要将消息作为字节数组传递。有没有办法将BSONDocument(特别是reactivemongo.bson.BSONDocument)转换为字节数组?
我正在尝试将从Mongo读取的BSONDocument发布到AWS Kinesis流中。但是,Kinesis API需要将消息作为字节数组传递。有没有办法将BSONDocument(特别是reactivemongo.bson.BSONDocument)转换为字节数组?
MongoClient m = new MongoClient("mongodb://localhost:27017");
var db = m.GetDatabase("TestDatabase");
var collection = db.GetCollection<BsonDocument>("SomeCollection");
// this will contain binary data (0s and 1s)
var binaryData = collection.Find("{SomeProperty:true}").ToBson();