Closed mikedizon closed 8 years ago
It is supported. Can you show me a small example that's not working for you?
It might be not clear from the docs, I should really work on that (PRs are always welcome :)), but insert expects 2 arguments. The first object being the primary index + optional global secondary index. The second argument being the rest of the document. So in your case, I think it should be something like this:
Could you try this one?
product.insert(
{
id: '6dc798c4d9dcd4cb72b3e590b2287a9b98f12c9b'
},
{
foo: {
id: '123',
email: 'abc@example.com'
},
shippingAddress: {
shipping_address_city: 'New York City',
shipping_address_country: 'United States',
shipping_address_country_code: 'US',
shipping_address_line1: '123 Fake St',
shipping_address_state: 'NY',
shipping_address_zip: '10005',
shipping_name: 'Name'
}
}
).exec().then(
reference => {
console.log('reference', reference)
})
Getting SyntaxError: missing ) after argument list
Can you take a screenshot of the error or copy paste it here in GitHub? This could provide me with useful information.
Here you go
This is not a dynongo issue. Aren't you using a file to write that code?
Save as index.js
'use strict';
const db = require('dynongo');
db.connect({
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey',
region: 'us-west-1'
});
// In case `Product` is your table name
const product = db.table('Product');
// Add your product.insert code here
Make sure to npm install dynongo
first and then run
$ node index.js
Just ran that, nothing printed. I'm currently debugging in the terminal if that makes any difference.
oh wow, that worked. can I not use this in a terminal session?
I don't think you can require packages right? If it is possible, then just make sure you did everything like I showed. If not, then no :).
Getting unknown operator varName when trying to insert a JSON object with nested documents. Is this not supported?