20 Matching Annotations
  1. Nov 2022
  2. May 2022
    1. // To make a nested object required, use a single nested schema const nameSchema = new Schema({ first: String, last: String }); personSchema = new Schema({ name: { type: nameSchema, required: true } });

      Notice How nameSchema is nested within personSchema object.

    2. Numbers have min and max validators. Strings have enum, match, minLength, and maxLength validators.

      Click the links here to get more detail on the validation specifics of Number and Strings types.

  3. Apr 2021
  4. Feb 2021
    1. return new Promise((resolve, reject) =>

      Notice that functions that you want to call (which you will prepend with "await"), must be structured to ALWAYS return a Promise as has been done here.