Code Monkey home page Code Monkey logo

mongoose-typescript-example's Introduction

Mongoose TypeScript example

Known Vulnerabilities GitHub stars GitHub license GitHub forks

This repo is example code that goes along with this medium aticle: https://medium.com/@tomanagle/strongly-typed-models-with-mongoose-and-typescript-7bc2f7197722

If you prefer a video: https://www.youtube.com/watch?v=TbT7eO1fxuI

The article explains how to use use TypeScript with your Mongoose models.

If something in the article or this repo needsfurther explanation or improvements, please sumit a pull request.

Testing

yarn test

The test command will setup a mongodb test server, connect to it, run your tests and the server will go through a teardown process to clean up all remaining listners.

Development

yarn dev

The run dev command will start the server and listen on the configured port. The port can be configured in ./src/index.ts

Support

Buy me a Coffee

Sign up to DigitalOcean I ๐Ÿ’– DigitalOcean

Subscribe on YouTube

mongoose-typescript-example's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar snyk-bot avatar tomanagle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongoose-typescript-example's Issues

Need a concrete class

User controller is creating a dynamic object while calling User.create. This object needs to have the same properties as defined in IUser.
I am not able to do something like :
new UserObj(x,y,x) and pass it to User.create.
Ideally I would like to define a concrete class like UserObj , fill it, and then invoke the model functions. that possible?

Embedding array of sub document in document?

thanks for your helpful sample.
I want to embed array of sub document in document (like embedding cars data in user document) and manage cars data separately. I want to know about schema definition and car controller for adding, removing and updating a car.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.