
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@mayajs/mongo
Advanced tools
A MayaJS module and service that deals with Mongodb drivers. It uses mongoose
as its core dependency to communicate with the database.
npm i @mayajs/mongo
MayaJS uses custom modules to add functionality on its core. You can use MongoDbModule
and import in on any MayaJS module in your project.
import { MongoDbModule } from "@mayajs/mongo";
import { Schema } from "mongoose";
// Define schema for mongoose
const User = new Schema({
name: String,
email: String,
password: String,
});
const mongodbOptions = {
connectionString: "your-mongodb-connection-string",
name: "your-collection-name",
options: {
// Any mongoose options can be used here
// i.e. useUnifiedTopology: true, useNewUrlParser: true, useFindAndModify: false
},
schemas: [
{
name: "User", // Name of model
schema: User, // Mongoose Schema
},
,
],
};
@Module({
imports: [MongoDbModule.forRoot(mongodbOptions)],
})
class CustomModule {}
To use mongodb inside your controller you will need to import MongoDbServices
. MongoDbServices provides set of functionality to access, manipulate and interact with mongodb.
MongoDbServices provides a database
function to access a specific collection in mongodb.
import { MongoDbServices } from "@mayajs/mongo";
@Controller()
class UsersController {
// Inject MongoDbServices in a controller
constructor(private mongo: MongoDbServices) {}
sample() {
// Get specific collection in mongodb
const db = this.mongo.database("your-collection-name");
}
}
To access a model you will need first the get the collection instance that we get from the above example. On the db instance you can access the model
object like seen below.
sample() {
// Get specific collection in mongodb
const db = this.mongo.database("your-collection-name");
// Get specific model instance
const model = db.instance.model("your-model-name");
}
This model instance is based on Mongoose Model. All of mongoose functionality is available for this model instance.
See collaborating guides here.
Author and maintainer Mac Ignacio
FAQs
MayaJS Mongo decorators and modules
The npm package @mayajs/mongo receives a total of 2 weekly downloads. As such, @mayajs/mongo popularity was classified as not popular.
We found that @mayajs/mongo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.