Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
mongoose-public-id
Advanced tools
Readme
Generates a public ID for your models which you can expose in your API.
{
_id: '58e175ba8a7ca30011d39c8f',
userId: '9zOROKPj4Ws4QzPaZGZK'
}
It also supports adding a prefix (similar how Stripe does it):
{
_id: '58e175ba8a7ca30011d39c8f',
userId: 'us_9zOROKPj4Ws4QzPaZGZK'
}
The plugin uses hashids to generate the public id based on the
_id
yarn install mongoose-public-id
The following example will add a new indexed field userId
to the model which will contain the public ID (eg: us_lO1DEQWBbQAACfHO
) based on the _id
field.
const mongoose = require('mongoose');
const publicId = require('mongoose-public-id');
const UserSchema = new mongoose.Schema({
username: String
});
UserSchema.plugin(publicId, {
namespace: 'us', // optional
prefix: '_' // default value,
fieldName: 'userId',
index: true // default value
});
This project is licensed under the MIT license. See the LICENSE file for more info.
FAQs
Generates a public ID for your models which you can expose in your API (similar to Stripe).
The npm package mongoose-public-id receives a total of 6 weekly downloads. As such, mongoose-public-id popularity was classified as not popular.
We found that mongoose-public-id 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.