Home

Awesome

MongoDB Style Guide

Table of Contents

  1. General
  2. Enumerations
  3. Booleans
  4. Dates
  5. Null and undefined
  6. Other types
  7. Names
  8. Object modelling

General

<a name='general--no-surprises'></a>

<a name='general--priorities'></a>

Enumerations

An enumeration is a type that allows a limited number of values, e.g. a role field that can contain the values 'DOCTOR', 'NURSE', 'PATIENT' and 'ADMINISTRATOR'.

<a name='enumerations--modelling'></a>

<a name='enumerations--explicit'></a>

Booleans

<a name='booleans--booleans-and-enums'></a>

<a name='booleans--prefix'></a>

<a name='booleans--orthogonal'></a>

Dates

<a name='dates--iso-strings'></a>

<a name='dates--day-strings'></a>

Null and undefined

<a name='null-and-undefined--no-overloading'></a>

<a name='null-and-undefined--sensible-default'></a>

<a name='null-and-undefined--primitive-types'></a>

<a name='null-and-undefined--objects-and-arrays'></a>

<a name='null-and-undefined--dont-mix'></a>

<a name='null-and-undefined--multiple-missing-value-states'></a>

Other types

<a name='other-types--mix'></a>

<a name='other-types--object-schema'></a>

<a name='other-types--falsiness'></a>

<a name='other-types--numbers-as-strings'></a>

<a name='other-types--numbers-with-unit'></a>

<a name='other-types--sets'></a>

<a name='other-types--object-ids'></a>

Names

<a name='names--abbreviations'></a>

<a name='names--key-names'></a>

<a name='names--collection-names'></a>

Object modelling

<a name='object-modelling--growth'></a>

<a name='object-modelling--excessive-nesting'></a>

Todo (pull requests welcome)