Search code examples
phpcollectionsmongodbschema-design

Mongo DB collection fields schema best practice


I would like to know how does i have to set up my collections schemas?

I mean first i need ,for example, a user object (username,email,password), then i need a field to make users confirm registration so need i to insert all fields when inserting users (username,email,password,confirm=0)

or

better to create confirm field only when user goes to confirm his registration account?


Solution

  • The missing confirm field tells you that it's 0, so both seem to be fine, it's just a matter of taste.