For this example, you only need to implement the schema for the words database to store words for the tables example. Listing 29.1 shows the WordSchema
model. You should already be familiar with this schema from Chapters 13–16.
01 var mongoose = require('mongoose'),
02 var Schema = mongoose.Schema;
03 var WordSchema = new Schema({
04 word: {type: String, index: 1, required:true, unique: true},
05 first: {type: String, index: 1},
06 last: String,
07 size: Number,
08 letters: [String],
09 stats: {
10 vowels:Number, consonants:Number},
11 charsets: [{ type: String, chars: [String]}]
12 });
13 mongoose.model('Word', WordSchema);