Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mongo storage adapter #1

Open
mahendraHegde opened this issue Mar 13, 2024 · 0 comments
Open

Add mongo storage adapter #1

mahendraHegde opened this issue Mar 13, 2024 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed storage-adapter

Comments

@mahendraHegde
Copy link
Owner

mahendraHegde commented Mar 13, 2024

to provide more flexibility in storage options, need to add mongoDB as a storage adapter.

it should implement the Storage interface

export interface StorageAdapter {
setIfNotExists: (
key: string,
val: string,
{ ttl }?: { ttl?: number },
) => Promise<boolean>;
set: (key: string, val: string, { ttl }: { ttl?: number }) => Promise<void>;
get: (key: string) => Promise<string | undefined>;
connect?: () => Promise<void>;
disconnect?: () => Promise<void>;
}

steps:

  1. add a new package similar to storage-adapter-redis
  2. implement Storage with mongo native driver(refer below PR)
  3. add tests

ref: #16
no need to provide enum based instantiation in shared repo, to reduce the bundle size, users will install the package and provide storageAdapter directly.

@mahendraHegde mahendraHegde added storage-adapter good first issue Good for newcomers help wanted Extra attention is needed labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed storage-adapter
Projects
None yet
Development

No branches or pull requests

1 participant