npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

moneasy

v1.0.6

Published

With moneasy, using the [mongoose](https://www.npmjs.com/package/mongoose) npm module will be made easy

Downloads

4

Readme

moneasy

With moneasy, using the mongoose npm module will be made easy

Installation

Execute this command in your project's cmd:

npm i moneasy

# Tags

# Methods:

- FindOne

  • TypeDefs:
    • MongooseModel Model | Your mongoose model from which you want to retrieve data
    • Object DocumentToFind | The document to retrieve
    • Boolean CreateIfDoesntExist (optional | default: false) | If true, a new model will be created with the value specified in the previous parameter
    • String ValueToFind (optional | default: "") | The specific value to retrieve within the document
const mon = require("moneasy");

await mon.FindOne(Model, DocumentToFind, CreateIfDoesntExist, ValueToFind);

# Example:

const mon = require("moneasy");
const Users = require("./databases/models/Users.js");

/*
Users database:
  - userId: 01
  - userName: Kevin
*/

mon.FindOne(Users, {userId: "01"}, true, "userName").then((res) => {
  console.log(res); // Returns: "Kevin"
});

mon.FindOne(Users, {userId: "02", userName: "Joe"}, true, "userName").then((res) => {
  console.log(res); // Returns: "Joe"
});

mon.FindOne(Users, {userId: "02"}, false).then((res) => {
  console.log(res); // Returns: {userId: 02, userName: "Joe"}
});

- UpdateOne

  • TypeDefs:
    • MongooseModel Model | The mongoose model you want to update
    • Object DocumentToFind | The document to find
    • Object DocumentToUpdate | The document you want to update (usually, this one has the same value as DocumentToFind)
    • Object ValueToUpdate | The new value of the document
    • Object ValueToCreate | The new value to create if the document is not found
const mon = require("moneasy");

await mon.UpdateOne(Model, DocumentToFind, DocumentToUpdate, ValueToUpdate, ValueToCreate);

# Example:

const mon = require("moneasy");

mon.UpdateOne(Users, {userId: "01"}, {userId: "01"}, {userName: "Tom"}, {userId: "01", userName: "Tom"}).then((res) => {
  console.log(res); // Returns: {userId: "01", userName: "Tom"}
});

mon.UpdateOne(Users, {userId: "02"}, {userId: "02"}, {userName: "Alexa"}, {userId: "02", userName: "Alexa"}).then((res) => {
  console.log(res); // Returns: {userId: "02", userName: "Alexa"}
});

This package will be continuously updated, adding even more options to make your development with mongoose easier

License

ISC License

ISC