gadelkareem / sails-dynamodb

Amazon DynamoDB adapter for Waterline / Sails.js
http://sailsjs.org
46 stars 22 forks source link

Create and findOrCreate not working? #33

Closed raul-medina-nussbaum closed 7 years ago

raul-medina-nussbaum commented 7 years ago

I managed to make find, findOne and save to work, but can't make create or findOrCreate to work. I don't know what I am doing wrong, or if the library doesn't have create yet.

This is how I'm calling the create method, to add a record to the table:

Model.create({ id: uuid.v4(), sku: params.sku, campo: params.campo }).exec(function(err, results){ if(err) return res.status(500).send(err); return res.status(200).send(results); });

And this is what I have on my models/Model.js file:

`module.exports = { attributes: { id: { type: 'string', primaryKey: 'hash' }, sku: { type: 'string', primaryKey: 'range' }, createdAt: { type: 'string' }, updatedAt: { type: 'string' }, campo: { type: 'string' }

} };`

So, do you have any idea on what am I doing wrong?