I have the following code to insert my POCO into a LiteDB instance.
Here is the POCO:
public class FileTranslationData
{
public Guid Id { get; set; }
public string FileLocation { get; set; }
public string FileJSONLocation { get; set; }
public int TranslationRetries { get; set; }
public string TranslationStatus { get; set; }
public string TranslationId { get; set; }
public string FileTranslationURL { get; set; }
}
And here is the call to insert the data into the collection:
public string SaveFileTranslationStatus([FromServices] LiteDbContext db, FileTranslationData data, string Collection)
{
var files = db.Context.GetCollection(Collection);
files.Insert(data);
files.EnsureIndex(x => x.id);
return null;
}
The files.Insert(data)
line is throwing an error:
Arguement 1: cannot convert from 'LargeFileDownload.Models.FileTranslationData' to 'LiteDB.BsonDocument'
I have read the documentation for LiteDB and it says it can handle inserting POCO objects. I have an ID field that I want to sent the index on as well. What am I missing here?