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
{{ message }}
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
While I was writing tests for transplant, I was testing the following:
create an index with primary key primary
add a document, and set primary key to primaru (testing that this is ignored):
{"primaru": 1, "text": "tata"}
I was expecting that there would be an error, since I have set the primary key to some value, and handed a document that doesn't contain this field. Yet this seems perfectly acceptable. Furthermore, when querying for the document back, I get:
[
{
"primaru": 1,
"text": "tata"
}
]
So there are no notion of the primary key. The document was given an id, but I have no way of knowing which. This is concerning, since as a user I specifically requested that a primary key is used, and yet, it is ignored.
Here is what I think should be the behaviour:
If the primary key is not set, and the engine can infer it, then it is set to the inferred value.
If it can't be infered, the engine creates a id field for each document, and uses it as a primary key. This fields should be added to all documents, and retrieved when doing a GET documents.
If the primary key is set, either manually or by any of the previous manners, then a document that lack this primary key causes the addition to fail with an error.
The text was updated successfully, but these errors were encountered:
Furthermore, I realized that when performing an empty document addition, the primary_key is still inferred to be id, but an empty document addition, with no primary_key in the request, should be considered as a no-op.
While I was writing tests for transplant, I was testing the following:
primary
primaru
(testing that this is ignored):I was expecting that there would be an error, since I have set the primary key to some value, and handed a document that doesn't contain this field. Yet this seems perfectly acceptable. Furthermore, when querying for the document back, I get:
So there are no notion of the primary key. The document was given an id, but I have no way of knowing which. This is concerning, since as a user I specifically requested that a primary key is used, and yet, it is ignored.
Here is what I think should be the behaviour:
id
field for each document, and uses it as a primary key. This fields should be added to all documents, and retrieved when doing aGET documents
.The text was updated successfully, but these errors were encountered: