json-mongo-model-parser

Simple package that allows you to parse a JSON file into a MongoDB model


Keywords
mongoose, mongodb, json, parser
License
MIT
Install
npm install json-mongo-model-parser@1.1.0

Documentation

How To Use It

First in first : You need to know how to use mongoDB and mongoose

Method List :

  • getModelsFromDirectory(path)

    This function take a param String that say where is the folder in wich you have your models.

    • Models will be returned as an Object full of Models.
    • If you want to use a specific Model you will need to destructurate the returned Object.

    The path must be relative :
    "/test/models/" -> "./models/"

  • getModelFromFile(path) This function take a param String that say where is the file you want to parse. The path must be relative : "/test/models/user.js" -> "./models/user.js"

Note : (there is no autocompletion for Model Names because of the way there are loaded in the system)

check test folder if you need a better exemple