How can I generate an autoincremented Id in a Cosmos DB if I do a POST request from Spring Boot.
The docs explain the behavior here: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/azure-spring-data-cosmos/README.md
public class GeneratedIdEntity {
@Id
@GeneratedValue
private String id;
}
As mentioned, Cosmos uses UUIDs rather than an auto-increment long.
Use @Id @GeneratedValue private String id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With