Closed ijsf closed 8 years ago
+1
Thanks for bringing this up!
I'll probably drop the id
alias and just use _id
for everything. Should be able to get out a fix tomorrow.
Scott
Ok so now I remember why I did this. You should be able to access the ID via document.id
(the alias) and document._id
(the original property). So then you can both access and query the ID with _id
.
The alias .id
is just supplemental and was added because Mongoose had it. I thought it would be convenient to have when switching ODMs.
Thoughts? Still think we should remove the .id
alias?
Scott
I thought it was a good addition at first, but it has to be consistent all the way through. Perhaps it will be better to remove it in favor of consistency with MongoDB.
Though, I'm not completely sure.
I've deprecated the id
alias, and will fully remove it in the next major version, so I'm closing the issue.
Thanks again!
There are some inconsistencies with the
_id
toid
field aliasing.When I perform a load call (e.g.
loadMany
with{}
empty query), camo returns objects with the_id
field aliased toid
:However, when specifying an actual input query to these load calls, I am unable to specify the
id
field, and instead have to specify MongoDB's original_id
field, as using theid
field yields no results at all:In other words, for queries, the
id
field is not aliased back to_id
, which is inconsistent with the load call result behavior, and requires the use of additional workarounds in the application using camo.