[jira] [Closed] (COUCHDB-3431) 400 error when posting valid JSON

2017-07-07 Thread Joan Touzet (JIRA)

 [ 
https://issues.apache.org/jira/browse/COUCHDB-3431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joan Touzet closed COUCHDB-3431.

Resolution: Fixed

> 400 error when posting valid JSON
> -
>
> Key: COUCHDB-3431
> URL: https://issues.apache.org/jira/browse/COUCHDB-3431
> Project: CouchDB
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: glen
>
> Is anything invalid about the first member of an array being an empty object?
> Please post [{}] to your Couch. Does your Couch return invalid json 400 
> error, or is it just me?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Closed] (COUCHDB-3431) 400 error when posting valid JSON

2017-07-07 Thread Joan Touzet (JIRA)

 [ 
https://issues.apache.org/jira/browse/COUCHDB-3431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joan Touzet closed COUCHDB-3431.

Resolution: Invalid

CouchDB is a document-oriented database, not an array-oriented database. As 
such, we require the top-level structure to be an object, not an array.

This is because, at the very least, we have to place an "_id":"" in the 
object to act as the "primary key" via which to access the document itself. We 
couldn't do this if the top-level is an array.


> 400 error when posting valid JSON
> -
>
> Key: COUCHDB-3431
> URL: https://issues.apache.org/jira/browse/COUCHDB-3431
> Project: CouchDB
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: glen
>
> Is anything invalid about the first member of an array being an empty object?
> Please post [{}] to your Couch. Does your Couch return invalid json 400 
> error, or is it just me?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Closed] (COUCHDB-3431) 400 error when posting valid JSON

2017-07-07 Thread Joan Touzet (JIRA)

 [ 
https://issues.apache.org/jira/browse/COUCHDB-3431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joan Touzet closed COUCHDB-3431.

Resolution: Fixed

It's whatever you're doing for encoding that is wrong. It definitely works.

$ curl -X PUT localhost:15984/foo
{"ok":true}
$ curl -X PUT localhost:15984/foo/bar -d '{"array":[{}]}'
{"ok":true,"id":"bar","rev":"1-3ff089b81196a0ce18d927c093a9b3de"}
 $ curl localhost:15984/foo/bar
{"_id":"bar","_rev":"1-3ff089b81196a0ce18d927c093a9b3de","array":[{}]}


> 400 error when posting valid JSON
> -
>
> Key: COUCHDB-3431
> URL: https://issues.apache.org/jira/browse/COUCHDB-3431
> Project: CouchDB
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: glen
>
> Is anything invalid about the first member of an array being an empty object?
> Please post [{}] to your Couch. Does your Couch return invalid json 400 
> error, or is it just me?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)