You seem to imply that there is only a single "table" or "collection in the -
MongoDB
- CouchDB speak, correct?
Right, there is only one collection per database which contains all its documents.
In that case the id as you've defined it must contains the table name, and each of the properties making up the id. But one has to admit that it does not make a really readable id value. anyone has alternative serialization approaches?
Yes, it's not really nice, but I don't see a good way around it. As said, I think we could omit the property name if the id comprises only of one property, making it look a bit nicer:
{
"_id": "News:619db7ba8551c0de3f3a178775509611"
...
}
I do agree with you that a non flat copy of the real id makes sense for query purposes. I'm tempted to rename 'tableName' with '_table' (or '_tableName' if you insist). It will make clear that we are talking about a technical field.
I like the underscore. I've not been happy about the term "table" in this context in the first place, I'd preferably go for "entityType" or similar.
|