Skip to content

Updating a nested field #146

Answered by mobsense
fifi98 asked this question in Q&A
Sep 30, 2021 · 7 comments · 10 replies
Discussion options

You must be logged in to vote

Wait on.

I've got your create and schema code wrong. Should be slides just as an object with no nested schema.

export default {
    version: '0.0.1',
    indexes: {
        primary: { hash: 'pk', sort: 'sk' },
    },
    models: {
        User: {
            pk:          { type: String, value: '${_type}#' },
            sk:          { type: String, value: '${_type}#${email}' },
            id:          { type: String, uuid: true },
            email:       { type: String },
            slides:      { type: Object }
            },
        }
    }
}

Then the code should be

    user = await User.create({
        email: '[email protected]',
        slides: {
            '4SWys5q0BhHOiTxlRbBsK': {
…

Replies: 7 comments 10 replies

Comment options

You must be logged in to vote
3 replies
@fifi98
Comment options

@mobsense
Comment options

@fifi98
Comment options

Comment options

You must be logged in to vote
6 replies
@mobsense
Comment options

@mobsense
Comment options

@fifi98
Comment options

@mobsense
Comment options

@fifi98
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fifi98
Comment options

Answer selected by fifi98
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants