/// <summary> /// Write a custom ReadBsonValue because BsonType changed from v6 to v7 /// </summary> private LiteDB.BsonValue ReadBsonValue(LiteDB.ByteReader reader, ushort length) { var type = reader.ReadByte(); // using numbers because BsonType changed switch (type) { case 1: return(LiteDB.BsonValue.Null); case 2: return(reader.ReadInt32()); case 3: return(reader.ReadInt64()); case 4: return(reader.ReadDouble()); case 5: return(reader.ReadString(length)); case 6: return(new LiteDB.BsonReader(false).ReadDocument(reader)); case 7: return(new LiteDB.BsonReader(false).ReadArray(reader)); case 8: return(reader.ReadBytes(length)); case 9: return(reader.ReadObjectId()); case 10: return(reader.ReadGuid()); case 11: return(reader.ReadBoolean()); case 12: return(reader.ReadDateTime()); case 13: return(reader.ReadDateTimeOffset(length)); case 0: return(LiteDB.BsonValue.MinValue); case 14: return(LiteDB.BsonValue.MaxValue); } throw new NotImplementedException(); }