Open weloytty opened 6 years ago
@cspotcode do you know where that may come from?
@vors, no I'm not sure, except it seems like somewhere we're accidentally putting a nonsense entry into the database. Maybe we're passing an incomplete object to the $mapper
somewhere? Like, what happens if we accidentally try to increase the weight for a path when no such path entry exists in the database? Just a guess.
Now that I think about it for a few more minutes, I suspect that's the problem. I suspect that somewhere we're calling Add-ZWeight
or $service.add()
with a null $path
. We have the Location class's path
field mapped as LiteDB's _id
. (LiteDB makes _id
mandatory; otherwise I would have named it path
within the database) So if $path
/_id
is unspecified, the database will auto-create an ID for that row, except the auto-created IDs aren't strings. Later, we try to map that row to a [Location]
instance, and it fails because it can't convert the _id
to Location
's path
field.
after a day or so of using ZLocation, I start to get this error:
When I go and look at z-location.db, I see, along with the normal entries, an entry like this:
[ { "_id": {"$oid": "5ba9f338cfbf5e28a8f1314c"}, "weight": 1.0 } ]
If I remove that from the db, things work again. (Until a day or so later when I get the error again)