Replies: 1 comment
-
@cckn You should be able to use the Something like this maybe? const schema = {
"id": {
"type": String,
"default": () => `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDay()}.${randomNumber()}`,
},
"name": String
};
const Entry = new Model(schema);
const entry = new Entry({
// id will be automatically generated based on the `default` function above
name: "John Doe"
});
// Random number between 1-200
function randomNumber() {
return Math.floor(Math.random() * 200) + 1;
} Note: I haven't actually tested this code. Just wrote it off the top of my head. But just meant to illustrate an example and not meant to be used in production. Hopefully this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Dynamoose Team,
I'm looking for ways to handle scenarios in DynamoDB where a single partition key has to accommodate a large number of items. AWS recommends write sharding as a solution (as seen in their partition key sharding guide and Amazon DynamoDB Labs sharding article).
Does Dynamoose have any features or best practices for implementing write sharding in this context? Any advice or shared experiences would be greatly appreciated.
Thanks!
P.S. I am currently exploring various libraries to better understand which one aligns best with my project's needs. In pursuit of gathering diverse insights, I've posed the same question in the Typedorm repository.
Beta Was this translation helpful? Give feedback.
All reactions