You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, I want Eve to do no objectid coercion aside from id fields so that I can store foreign mongo ids and still have post and get working.
Background
On from #599, #600, #1164, it's not uncommon to have a service that allows clients to put data to the server and give the data handles determined by the client. If the client side developers are also using mongodb then it's a real use case to have strings that can be parsed as objectid but that we don't want to have as objectids.
This works with query_objectid_as_string however in more complicated queries where we mix in actual objectids, it can break.
The fix here looks like it does the simplest thing that could work by checking to see if the type being gotten is an id field and if it is, always cast to objectid.
Example use case
A photo service where users can set a handle for the photos. A client uploads the photo and sets the handle as their local objectid. On the server (Eve) side, the user id is an _id. And the photo id is a string. The resulting request would fail with query_objectid_as_string set to either False or True:
As a developer, I want Eve to do no objectid coercion aside from id fields so that I can store foreign mongo ids and still have post and get working.
Background
On from #599, #600, #1164, it's not uncommon to have a service that allows clients to put data to the server and give the data handles determined by the client. If the client side developers are also using mongodb then it's a real use case to have strings that can be parsed as objectid but that we don't want to have as objectids.
This works with
query_objectid_as_string
however in more complicated queries where we mix in actual objectids, it can break.The fix here looks like it does the simplest thing that could work by checking to see if the type being gotten is an id field and if it is, always cast to objectid.
Example use case
A photo service where users can set a handle for the photos. A client uploads the photo and sets the handle as their local objectid. On the server (Eve) side, the user id is an
_id
. And the photo id is a string. The resulting request would fail withquery_objectid_as_string
set to eitherFalse
orTrue
:I think the prototype posted in #1164 would fix this.
The text was updated successfully, but these errors were encountered: