Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mayajs/mongo

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mayajs/mongo

MayaJS Mongo decorators and modules

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-92.86%
Maintainers
1
Weekly downloads
 
Created
Source

Mongo Decorators and Modules

Description

This is a MayaJS library that deals with Mongodb drivers. It uses mongoose to connect to any mongodb database. It also use mongoose Schema and Model for its model creation.

Decorators

Models

Creates a model intance based on the name passed on the parameter.

MayaJS collect and store all the models defined on the @Controller decorators to a single object. Everytime the @Models decorator is attached to a variable it replace its value with a model instance. This model instance is based on mongoose model. All of mongoose functionality is available for this model instance.

Pseudo Code
   @Models(model_name:string) varaiable_name;
Sample Code
   @Models("sample") model;

Modules

Mongo

A wrapper for mongoose that MayaJS use to connect to MongoDB.

Mongo accepts an object settings that will set the connection for MongoDB. MayaJS will automatically connect to the specified settings whenever the server starts. It will also set the models using the models function. It typically used inside the @App decorator on the options paramater.

Options
{
  connectionString: string; // Connection string
  options?: ConnectionOptions; // Mongoose connect options OPTIONAL
}

NOTE: See full documentation of ConnectionOptions here.

Sample Code
@App({
  database: Mongo({
    connectionString: process.env.MONGO_CONNECTION_URL || "your-connection-string-here",
    options: { useCreateIndex: true, useNewUrlParser: true, useFindAndModify: false },
  }),
})
export class AppModule {}

FAQs

Package last updated on 24 Dec 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc