So I'm trying to send some data in a JSON format to a CouchDB database.I'm using jQuery $ajax function for that. My code looks more or less like this:
var someData= { "questions_data" :
{ "1": {"username": "John", "userid": "123456", "date": "12/12/2004"},
"2": {"username": "Mary", "userid": "123457", "date": "22/12/2004"}}};
$.ajax({
type: 'POST',
data: someData,
url: '/smth/addquestion/' + id
dataType: 'json'
}).done(function( res ) {
...;
And the data gets to the database as:
'questions_data[1][username]': 'John',
'questions_data[1][userid]': '123456',
'questions_data[1][date]': '12/12/2004'...
With each 'questions_data[1]...'
taking up one field of a databse document. But what I'm trying to do here is to put it all in one field - 'questions_data'
and to make the rest of the request the value of this field. Can somebody help me out here please?