tiedot icon indicating copy to clipboard operation
tiedot copied to clipboard

add document entry

Open snapo opened this issue 8 years ago • 1 comments

Hi , First many thanks for creating this go project, im also getting in to golang and did just wanna take a look on your nosql server. Im in the following problem while testing the server (probably my error). I did not found a way to add an entry to a existing document...

  1. create?col=123
  2. '{"a": 1, "b": 2}' insert?col=123

now i need to add c3 so my steps are

  1. query?q=123 (so i get the document ID)
  2. get?col=Feeds&id=123123123123123123123
  3. Save response in memory (on local computer)
  4. add additional key/value in memory (on local computer)
  5. '{"a": 1, "b": 2, "c": 3}' update?col=Feeds&id=123123123123123

Because its my first document DB i would like to ask if this way is correct, or is there a shorter way like: '{"c": 3}' addvalueallifnotexist?col=123 '{"c": 3}' addvaluealloverwriteifexist?col=123

i am asking this because i have only 1 document per collection and the documents are kind big. currently there is not so much traffic and concurrent sessions... but in the future it could really have a impact :-(

If im doing all wrong, then you can close the case, otherwise its a feature request. (yes im using your DB as a key/value store)

Best regards And many thanks for developing such a great Server

snapo avatar Aug 09 '16 21:08 snapo

Appreciate your feedback, and the procedure you described is the best approach as of now.

A more convenient way to update values inside document should be a good enhancement.

HouzuoGuo avatar Aug 16 '16 09:08 HouzuoGuo