Kernel Code Development Rules

JS Style Guide

MongoDB follows the google javascript style guide.

Git Committing and Pushing

  • Commit messages should have the JIRA ticket in the message: SERVER-XXXXX.
  • Do not push until running the test suite.

User Facing Conventions


These are very important as we can’t change them easily – Much more than code conventions!

Anything users see – command line options, command names, command output, we need to think hard and carefully about the name to be used, and the exact format and consistency of the items output. For example, serverStatus output is a bit of a mismash of lowercase and camelCase. Let’s fix that over time, starting with new things.

Anything user facing must be run by kernel leads first.


  • Do NOT add a new $operator without signoff by kernel-leads.
  • Do NOT add a new command without signoff by kernel-leads.

Use camelCase for Just About Everything

  • --commandLineOptions
  • { commandNames : 1, commandOption : "abc" }
  • Names of fields in objects we generate - such as command responses, profiler fields.

Include units in fields

In things like serverStatus, include the units in the stat name if there is any chance of ambiguity. For example:

  • writtenMB
  • timeMs

We should have standards for these – i.e. megabytes should always be MB and not Mb and Megabytes in different places. So the standards are:

  • For bytes: use MB and show in megabytes unless you know it will be tiny. Note you can use a float so 0.1MB is fine to show.
  • For time: use millis (Ms) for time by default. You can also use Secs and a float for times you know will be very long.
  • For microseconds, use Micros as the suffix, e.g., timeMicros.