Socket
Socket
Sign inDemoInstall

mongoose-auto-ts

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mongoose-auto-ts

This tiny package infers types from mongoose schema without needing to do that manually.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

mongoose-auto-ts




Installation:

npm i mongoose-auto-ts

Description:

This tiny package infers types from mongoose schema without needing to do that manually.



Usage:

// Schema & model must be imported from this package instead of mongoose.
import { Schema, model } from 'mongoose-auto-ts';

//Options argument has two extra properties: statics AND methods.
const UserSchema = new Schema({
	email: {
		type: String,
		required: true,,
		unique: true,
	},
	password: {
		type: String,
		required: true,
	},
},
 {
      statics: {
      // Static methods should be defined here to be able to get better hints.
      },
      methods: {
       // Instance methods should be defined here to be able to get better hints.
       }
 });

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

export default User;

Keywords

FAQs

Last updated on 26 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc