Key Values
NemesisDB uses the key-value nature of JSON to manage data.
If we have this JSON:
{
"age":50,
"cars":["BMW", "Ford"],
"address":
{
"city":"Paris",
"country":"France"
}
}
age, cars and address are keys:
agehas a number valuecarshas an array valueaddresshas an object value
This is how NemesisDB treats the data when stored:
ageis mapped to50carsis mapped to["BMW", "Ford"]addressis mapped to{"city":"Paris","country":"France"}
Set
To store the above, you can use the KV_SET command:
{
"KV_SET":
{
"keys":
{
"age":50,
"cars":["BMW", "Ford"],
"address":
{
"city":"Paris",
"country":"France"
}
}
}
}
keyscontains the keys and values to store
Get
To get the above keys:
{
"KV_GET":
{
"keys":["age", "cars", "address"]
}
}
keysan array of keys to retrieve
This returns:
{
"KV_GET_RSP":
{
"keys":
{
"age":50,
"cars":["BMW", "Ford"],
"address":
{
"city":"Paris",
"country":"France"
}
}
}
}