import mongoose from 'mongoose'; import db from '../db'; const NoteSchema = new mongoose.Schema({ comment: String, sample_references: [{ sample_id: mongoose.Schema.Types.ObjectId, relation: String }], custom_fields: mongoose.Schema.Types.Mixed }); // changelog query helper NoteSchema.query.log = function > (req) { db.log(req, this); return this; } export default mongoose.model>('note', NoteSchema);