Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] InvalidCastException From LiteDB.ObjectId To System.String #2590

Open
R2R2HS opened this issue Feb 19, 2025 · 0 comments
Open

[BUG] InvalidCastException From LiteDB.ObjectId To System.String #2590

R2R2HS opened this issue Feb 19, 2025 · 0 comments
Labels

Comments

@R2R2HS
Copy link

R2R2HS commented Feb 19, 2025

Version: v5.0.21

Code to Reproduce

using LiteDatabase db = new("My.db");
ILiteCollection<RoflType> col = db.GetCollection<RoflType>();
col.DeleteAll();

// Only if Id is a property!
// InvalidCastException From LiteDB.ObjectId To System.String
BsonValue v = col.Insert(new RoflType("MyName")); 
public class RoflType(string id, string name)
{
    public RoflType(string name) : this(string.Empty, name) { }

    public string Id { get; set; } = id;

    public string Name { get; set; } = name;
}
@R2R2HS R2R2HS added the bug label Feb 19, 2025
@R2R2HS R2R2HS changed the title [BUG] [BUG] InvalidCastException From LiteDB.ObjectId To System.String Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant