Closed TanmoySG closed 11 months ago
Currently, _id is generated and used as primary identifier for a data-row(?). For example, now for data inserted , the Primary ID
_id
{ "name" : "T", "student_id" : 0123, "age": 21 }
the Identifier is random generated identifier _id,
{ "axo0193nc4101383" : {"name" : "T", "student_id" : 0123, "age": 21}, }
For advanced use-cases, user might want to use any of the field values as identifier instead of _id. Eg instead of _id we want to use student_id as primary key.
student_id
{ "0123" : {"name" : "T", "student_id" : 0123, "age": 21}, }
Possible solutions
IdentifierField
identifier
{ "name": "test-metadata1", "schema": {"type": "object", "properties": {"name": {"type": "string"}},"required": ["name"]}, "identifier" : "name" }
required
data[identifier.value]
Currently,
_id
is generated and used as primary identifier for a data-row(?). For example, now for data inserted , the Primary IDthe Identifier is random generated identifier
_id
,For advanced use-cases, user might want to use any of the field values as identifier instead of
_id
. Eg instead of_id
we want to usestudent_id
as primary key.Possible solutions
IdentifierField
(string) in the Datum struct https://github.com/TanmoySG/wunderDB/blob/e7b8cdd80d29786ef01761c2524a4397b37b2d34/model/models.go#L42-L46identifier
required
array of the schema - request valid only if it is there or if not there can add through code._id
or any other custom field,data[identifier.value]
if not insert the data