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

@grammyjs/storage-mongodb

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grammyjs/storage-mongodb

MongoDB storage for grammy library.

  • 2.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
170
increased by38.21%
Maintainers
2
Weekly downloads
 
Created
Source

MongoDB storage adapter for grammY

Storage adapter that can be used to store your session data with MongoDB when using sessions.

Compatible with deno and node!

Installation

Node

npm install @grammyjs/storage-mongodb --save

Deno

import {
  ISession,
  MongoDBAdapter,
} from "https://deno.land/x/grammy_storages/mongodb/src/mod.ts";

Usage

You can see examples/ which contains both Deno and Node examples.

Mongoose

If you use Mongoose for operations with mongodb, you can still use this adapter. You need to get a native connection and use it:

import mongoose from "mongoose";
import { MongoDBAdapter, ISession } from "@grammyjs/storage-mongodb";

await mongoose.connect("mongodb://localhost:27017/test");

const collection = mongoose.connection.db.collection<ISession>(
  "sessions",
);

bot.use(session({
    initial: (): SessionData => ({
        pizzaCount: 0,
    }),
    storage: new MongoDBAdapter({ collection }),
}))

FAQs

Package last updated on 29 Feb 2024

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