spring-projects / spring-session-data-mongodb

Spring Session for MongoDB
https://spring.io/projects/spring-session-data-mongodb
Apache License 2.0
50 stars 35 forks source link

Annotation for Default Value #100

Closed aymen94 closed 5 years ago

aymen94 commented 5 years ago

during the creation of the schema, there is no notation that says "in the case of a null field or not present to assign them a default" example: when I define a mongo scheme

new Schema({ 
    count: { type: Number, default: 0 }
});

I also want that when I don't pass the field the value of default appears in the object.

Expected behavior

@DefaultValue(0)
int count;

Actual behavior

every time I send the object I initialize the field to let me add in mongo.

@Field 
int count = 0;

I also accept changes or suggestions.

gregturn commented 5 years ago

Is this supposed to be for Spring Session MongoDB or Spring Data MongoDB?

aymen94 commented 5 years ago

@gregturn is for Spring Data MongoDB

gregturn commented 5 years ago

Then you may wish to close this issue and visit jira.spring.io.

aymen94 commented 5 years ago

https://jira.spring.io/browse/DATAMONGO-2350