Skip to content

@casl/mongoose@5.0.0

Choose a tag to compare

@stalniy stalniy released this 10 May 19:09

5.0.0 (2021-05-10)

Code Refactoring

  • mongoose: migrates @casl/mongoose to official mongoose types (0379e7b), closes #436

BREAKING CHANGES

  • mongoose: migrates @casl/mongoose to official mongoose types. This is a breaking change for TypeScript users. What you need to do is to

    npm uninstall @types/mongoose

    and extend model interfaces by mongoose.Document

    Before

    interface Post {
      title: string;
      content: string;
    }
    
    const schema = new mongoose.Schema<Post>({
      // model definition
    });

    After

    import mongoose from "mongoose";
    
    interface Post extends mongoose.Document {
      title: string;
      content: string;
    }
    
    const schema = new mongoose.Schema<Post>({
      // model definition
    });

    For example, check updated README.md