Spring boot data update existing record without version

Viewed 12

I have a collection in mongo containing both new data with the version field and old data imported from an old couchbase bucket which doesn't contain the version field. How can I update an existing record? i.e. adding the version=0 automatically on save?

    public class Entity {
        private String someField;

        @CreatedDate
        private Instant createdAt;

        @LastModifiedDate
        private Instant updatedAt;

        @Version
        private Long version;
    }
0 Answers
Related