public class Product {
@Id
private String productId;
private BigInteger stock;
}
template.save(product);
stock is saved as string in mongo collection eg : {"stock":"20"} , it should be saved as {"stock":20} , how to store this as number ?
Looking at the source code, that simply is what Spring decides to use as a representation. The underlying problem is that there is no valid numeric MongoDB datatype that can be used to reliably represent all possible values of BigInteger.