schema mongoose

JavaScript
const mongoose = require('mongoose');

const UserSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true
    }
}, {
    timestamps: true
})

const User = mongoose.model('User', UserSchema);

module.exports = User;  var mongoose = require('mongoose');
  var Schema = mongoose.Schema;

  var blogSchema = new Schema({
    title:  String, // String is shorthand for {type: String}
    author: String,
    body:   String,
    comments: [{ body: String, date: Date }],
    date: { type: Date, default: Date.now },
    hidden: Boolean,
    meta: {
      votes: Number,
      favs:  Number
    }
  });const fruitSchema = new mongoose.Schema ({
  name: {
    type: String
  },
  rating: {
    type: Number,
    min: 1,
    max: 10
  },
  review: String
});
Source

Also in JavaScript: