karras icon indicating copy to clipboard operation
karras copied to clipboard

fetch-by-id requires :id to be of type ObjectId

Open scotthernandez opened this issue 13 years ago • 1 comments

If I'm reading this code correctly, and it is very possible I am not... It seems like a limitation if you store other types of values in your _id field. It is best not to make assumptions like this about types; it is also good not to coerce strings -> ObjectId as you have a chance of missing valid string values. If you really must do this at least check to see if the string is a valid ObjectId first.

https://github.com/wilkes/karras/blob/master/src/karras/collection.clj#L170

scotthernandez avatar Sep 17 '11 14:09 scotthernandez

Agreed. That procedure is simply an artifact of laziness from using this library on an internal project. I'll clean it up.

wilkes avatar Sep 19 '11 14:09 wilkes