Closed wbprice closed 10 years ago
that's mongodb standard document ID that gets added on insert. It should stay there for proper db function.
Is this something that should be filtered out by the API when it serves JSON to the front-end?
These will be the ids you will reference for requesting specific documents. They shouldn't be served to the end user though.
For the API, the frontend should pass these as strings which will be converted by the API to objectids for the purposes of interfacing with Mongo.
At least that's what I think right now while the API is purely a pipe dream.
Sounds good. I want to keep what I'm doing right now somewhat grounded in reality, so I'll just assume that I'm working with strings for the time being.
Is this something that should be filtered out by the API when it serves JSON to the front-end?
Yes. The server will convert the GUID to a string before sending it through the API.
Yup, this is what's happening now that my local copy is pulling from the API.
The first couple of lines in the JSON for a given restuarant include something like:
"_id" : ObjectId("530907537d95393b690c216d"),
Looks like this is a function in a JSON, which doesn't validate. Deleting this line causes everything to work again. Not an ideal solution because this line serves as a good unique ID. Find some way to sanitize this input in API or in front-end?