-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behavior when setting a doc body to nil #15
Comments
I think the problem is that KV stores store []byte. You can't store nil, you can only store an empty byte array. One option is that we throw an error if you try to store nil. But, before that I think we should just look at what the C library does. It looks to me like we're just passing through to C, so the same issue is either a bug, or not an issue at the C level. |
Setting body to null is the equivalent of issuing a delete. (That is how On Mon, Apr 13, 2015 at 9:47 AM, Marty Schoch [email protected]
|
Welcome to the joy of goforestdb, time to go back and write some C code... |
@hisundar can the behavior you just mentioned be added to the api docs? https://github.com/couchbase/forestdb/wiki/Public-APIs#changing-a-documents-contents + the header file (if not already, I didn't check) |
Sorry for the miscommunication. Setting the doc body to NULL is NOT the On Mon, Apr 13, 2015 at 10:26 AM, Traun Leyden [email protected]
|
Yeah I've just gone through the C version and it behaves as expected. The issue is we cannot really store nil, currently when requested to do this, we store an empty byte slice. You notice the problem when you get the value back, because we return you the empty byte slice. Option 1: leave it the way it is, storing nil is a shortcut for saving an empty byte slice |
When I set a doc body to nil and the retrieve the doc, it's returning an empty slice (and I was expecting it to return a nil doc body)
Steps to reproduce:
Test case
The text was updated successfully, but these errors were encountered: