Fix extra values

This commit is contained in:
2024-12-15 18:03:18 +03:30
parent 811a54e24d
commit 29011e34f9
2 changed files with 4 additions and 1 deletions

View File

@@ -1,9 +1,12 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Telegram.Bot.Types; using Telegram.Bot.Types;
namespace mstdnCats.Models namespace mstdnCats.Models
{ {
[BsonIgnoreExtraElements]
public class Post public class Post
{ {
[JsonPropertyName("id")] [JsonPropertyName("id")]

View File

@@ -14,7 +14,7 @@ public class HandleDbBackup
{ {
logger?.LogInformation("Backup requested"); logger?.LogInformation("Backup requested");
// Retrieve all posts from DB // Retrieve all posts from DB (Exclude _id field from mongoDB since it is not needed nor implemented in Post model)
var posts = _db.AsQueryable().ToList(); var posts = _db.AsQueryable().ToList();
// Retrieve all existing posts in backup DB // Retrieve all existing posts in backup DB
var existingPosts = _bkDb.AsQueryable().ToList(); var existingPosts = _bkDb.AsQueryable().ToList();