using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; namespace Model { public class DataModel { public DataModel(string id) { this.id = id; } public DataModel() { this.id = ObjectId.GenerateNewId().ToString(); } [BsonId] public string id { get; set; } [BsonElement("message")] public string? message { get; set; } } }