0.18.1 • Published 5 months ago

@zakodium/adonis-mongodb v0.18.1

Weekly downloads
54
License
MIT
Repository
github
Last release
5 months ago

Adonis MongoDB

MongoDB provider for AdonisJS 5.

NPM version build status Test coverage npm download

:warning: This module is unstable and in active development. Use at your own risk.

Prerequisites

This provider requires AdonisJS v5 and won't work with AdonisJS v4.

We recommend using MongoDB >=5.0. Earlier versions are not tested.

Installation

npm i @zakodium/adonis-mongodb
node ace configure @zakodium/adonis-mongodb

Documentation

Using with the authentication provider

Adonis MongoDB can be used to authenticate users with the @adonisjs/auth addon. To enable it, edit the following files:

contracts/auth.ts

Example of a configuration with the session guard:

import {
  MongodbModelAuthProviderContract,
  MongodbModelAuthProviderConfig,
} from '@ioc:Zakodium/Mongodb/Odm';

import User from 'App/Models/User';

declare module '@ioc:Adonis/Addons/Auth' {
  interface ProvidersList {
    user: {
      implementation: MongodbModelAuthProviderContract<typeof User>;
      config: MongodbModelAuthProviderConfig<typeof User>;
    };
  }

  interface GuardsList {
    web: {
      implementation: SessionGuardContract<'user', 'web'>;
      config: SessionGuardConfig<'user'>;
    };
  }
}

config/auth.ts

import { AuthConfig } from '@ioc:Adonis/Addons/Auth';

const authConfig: AuthConfig = {
  guard: 'web',
  guards: {
    web: {
      driver: 'session',
      provider: {
        driver: 'mongodb-model',
      },
    },
  },
};

export default authConfig;

Development

To run tests locally:

docker-compose up -d
node reset-dev.mjs
npm test
docker-compose down

License

MIT

0.18.1

5 months ago

0.16.0

6 months ago

0.17.0

6 months ago

0.18.0

5 months ago

0.15.0

10 months ago

0.14.4

11 months ago

0.14.1

1 year ago

0.14.2

1 year ago

0.14.3

1 year ago

0.14.0

1 year ago

0.13.0

2 years ago

0.12.0

3 years ago

0.11.0

3 years ago

0.10.6

3 years ago

0.10.3

3 years ago

0.10.4

3 years ago

0.10.2

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.9.1

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago