我需要使用 Dynamoose 将这样的对象保存到 DynamoDB 文档中。然而model
,价值正在变成 Dynamoose 对象的 JSON 对象……如果这有意义的话。
所以以下内容:
{
id: '621768c4-05c3-4e21-9120-99f4858266eb',
make: 'Yamaha',
model: 'R1'
}
保存为model
这个,而不是R1。
{
"originalName": {
"S": "cache"
},
"pendingTasks": {
"L": []
},
"latestTableDetails": {
"M": {
"Table": {
"M": {
"TableName": {
"S": "dev-vehicle-lookup-api-cache"
},
"AttributeDefinitions": {
"L": [
{
"M": {
"AttributeName": {
"S": "id"
},
"AttributeType": {
"S": "S"
}
}
}
]
},
"CreationDateTime": {
"M": {}
},
"TableSizeBytes": {
"N": "2582"
},
"TableArn": {
"S": "arn:aws:dynamodb:ddblocal:000000000000:table/dev-vehicle-lookup-api-cache"
},
"TableStatus": {
"S": "ACTIVE"
},
"ItemCount": {
"N": "1"
},
"ProvisionedThroughput": {
"M": {
"WriteCapacityUnits": {
"N": "0"
},
"LastIncreaseDateTime": {
"M": {}
},
"NumberOfDecreasesToday": {
"N": "0"
},
"LastDecreaseDateTime": {
"M": {}
},
"ReadCapacityUnits": {
"N": "0"
}
}
},
"KeySchema": {
"L": [
{
"M": {
"KeyType": {
"S": "HASH"
},
"AttributeName": {
"S": "id"
}
}
}
]
},
"BillingModeSummary": {
"M": {
"BillingMode": {
"S": "PAY_PER_REQUEST"
},
"LastUpdateToPayPerRequestDateTime": {
"M": {}
}
}
}
}
}
}
},
"ready": {
"BOOL": true
},
"methods": {
"M": {
"document": {
"M": {}
}
}
},
"schemas": {
"L": [
{
"M": {
"settings": {
"M": {
"saveUnknown": {
"L": [
{
"S": "**"
}
]
},
"timestamps": {
"M": {
"createdAt": {
"S": "createdAt"
},
"updatedAt": {
"S": "updatedAt"
}
}
}
}
},
"getIndexRangeKeyAttributes": {
"M": {}
},
"getIndexes": {
"M": {}
},
"requiredCheck": {
"M": {}
},
"schemaObject": {
"M": {
"id": {
"M": {
"required": {
"BOOL": true
}
}
}
}
},
"getIndexAttributes": {
"M": {}
}
}
}
]
},
"options": {
"M": {
"populate": {
"BOOL": false
},
"waitForActive": {
"M": {
"enabled": {
"BOOL": true
},
"check": {
"M": {
"timeout": {
"N": "180000"
},
"frequency": {
"N": "1000"
}
}
}
}
},
"prefix": {
"S": "dev-vehicle-lookup-api-"
},
"create": {
"BOOL": false
},
"update": {
"BOOL": false
},
"throughput": {
"M": {
"write": {
"N": "1"
},
"read": {
"N": "1"
}
}
},
"suffix": {
"S": ""
}
}
},
"name": {
"S": "dev-vehicle-lookup-api-cache"
},
"serializer": {
"M": {
"default": {
"M": {}
}
}
},
"alreadyCreated": {
"BOOL": false
}
}