{"action":"closed","issue":{"url":"https://api.github.com/repos/robconery/massive-js/issues/122","labels_url":"https://api.github.com/repos/robconery/massive-js/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/robconery/massive-js/issues/122/comments","events_url":"https://api.github.com/repos/robconery/massive-js/issues/122/events","html_url":"https://github.com/robconery/massive-js/issues/122","id":106647417,"number":122,"title":"Table.save throwing exception trying to save object","user":{"login":"matheo","id":260185,"avatar_url":"https://avatars.githubusercontent.com/u/260185?v=3","gravatar_id":"","url":"https://api.github.com/users/matheo","html_url":"https://github.com/matheo","followers_url":"https://api.github.com/users/matheo/followers","following_url":"https://api.github.com/users/matheo/following{/other_user}","gists_url":"https://api.github.com/users/matheo/gists{/gist_id}","starred_url":"https://api.github.com/users/matheo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matheo/subscriptions","organizations_url":"https://api.github.com/users/matheo/orgs","repos_url":"https://api.github.com/users/matheo/repos","events_url":"https://api.github.com/users/matheo/events{/privacy}","received_events_url":"https://api.github.com/users/matheo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-15T21:09:12Z","updated_at":"2015-09-15T22:29:14Z","closed_at":"2015-09-15T22:29:14Z","body":"Hi all! First, thanks for this great lib!\r\n\r\nI'm starting with Massive as it looks super cool to keep my apps on the top of my loved postgres, but I'm having some issues setting up a first app using it. I have a table named \"eventos\" with 6 columns [id (pk), titulo (not null), fecha, tipo, empleado, obs] and I'm trying to save an object through `POST /eventos` with:\r\n```\r\ncurl --data 'titulo=Entrada&fecha=144102924600' http://localhost:3000/eventos\r\n```\r\n\r\n## My node app\r\napp.js\r\n```\r\nvar app = express();\r\n\r\nvar massive = require(\"massive\");\r\nvar connectionString = \"postgres://user:pass@localhost/mydb\";\r\nvar massiveInstance = massive.connectSync({connectionString : connectionString});\r\napp.set('db', massiveInstance);\r\n\r\nvar routes = require('./routes/index');\r\n...\r\n```\r\nroutes/index.js\r\n```\r\nrouter.post('/eventos', function(req, res, next) {\r\n  var db = req.app.get('db');\r\n\r\n  db.eventos.save(req.body, function(err, event){\r\n    if(err){ return next(err); }\r\n    res.json(event);\r\n  });\r\n});\r\n```\r\n\r\n### First Exception\r\n```\r\n<h1>array value must start with &#34;{&#34; or dimension information</h1>\r\n<h2></h2>\r\n<pre>Error: array value must start with &#34;{&#34; or dimension information\r\n    at DB.query (/events/node_modules/massive/lib/runner.js:17:11)\r\n    at Table.insert (/events/node_modules/massive/lib/table.js:38:11)\r\n    at Table.save (/events/node_modules/massive/lib/table.js:107:10)\r\n    at /events/routes/index.js:21:14\r\n    at Layer.handle [as handle_request] (/events/node_modules/express/lib/router/layer.js:95:5)\r\n    at next (/events/node_modules/express/lib/router/route.js:131:13)\r\n    at Route.dispatch (/events/node_modules/express/lib/router/route.js:112:3)\r\n    at Layer.handle [as handle_request] (/events/node_modules/express/lib/router/layer.js:95:5)\r\n    at /events/node_modules/express/lib/router/index.js:277:22\r\n    at Function.process_params (/events/node_modules/express/lib/router/index.js:330:12)</pre>\r\n```\r\nso I \"jsonify\" the input data and try again:\r\n\r\n### Second Exception\r\nso I change the input data like:\r\n```\r\nrouter.post('/eventos', function(req, res, next) {\r\n  var db = req.app.get('db');\r\n\r\n  rec = JSON.stringify(req.body);\r\n\r\n  db.eventos.save(rec, function(err, event){\r\n    if(err){ return next(err); }\r\n    res.json(event);\r\n  });\r\n});\r\n```\r\n\r\nand trying again I get a new one:\r\n```\r\n<h1>Please pass in the criteria for saving as an object. This should include all fields needed to change or add. Include the primary key for an UPDATE.</h1>\r\n<h2></h2>\r\n<pre>AssertionError: Please pass in the criteria for saving as an object. This should include all fields needed to change or add. Include the primary key for an UPDATE.\r\n    at Table.save (/events/node_modules/massive/lib/table.js:102:3)\r\n    at /events/routes/index.js:21:14\r\n    at Layer.handle [as handle_request] (/events/node_modules/express/lib/router/layer.js:95:5)\r\n    at next (/events/node_modules/express/lib/router/route.js:131:13)\r\n    at Route.dispatch (/events/node_modules/express/lib/router/route.js:112:3)\r\n    at Layer.handle [as handle_request] (/events/node_modules/express/lib/router/layer.js:95:5)\r\n    at /events/node_modules/express/lib/router/index.js:277:22\r\n    at Function.process_params (/events/node_modules/express/lib/router/index.js:330:12)\r\n    at next (/events/node_modules/express/lib/router/index.js:271:10)\r\n    at Function.handle (/events/node_modules/express/lib/router/index.js:176:3)</pre>\r\n```\r\n\r\nWhat's happening? how can I make this work?\r\nThanks in advance!"}}