I'm implementing the UPDATE part of a CRUD interface, and using LiteDB to store my collection of objects.
The objects I am storing are Schedules and Schedule.ScheduleName is the index on the collection. Schedule.ScheduleName is the [BsonId] of the type.
My Update method is pretty darned simple:
public bool UpdateSchedule(Schedule schedule, string scheduleID)
{
return scheduleCollection.Update(scheduleID, schedule);
}
Will that do what I'm expecting, however? If the schedule object being provided has the new name in it, and schjeduleID is the old name, I expect it will go find the old entry under scheduleID and update it with whatever is in the new Schedule object. But will it?
And if so, is that the correct way to implment the U part of CRUD? Do I have the semantics right? I can't think of any other way to rename or change and object's ID otherwise!