# joi-objectid

> A MongoDB ObjectId validator for Joi

Latest version **4.0.2** (published 2021-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install joi-objectid
pnpm add joi-objectid
yarn add joi-objectid
bun add joi-objectid
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2021-09-11 |
| First published | 2014-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Aaron Heckmann |
| Maintainers | mkg20001 |

## Links

- npm: https://www.npmjs.com/package/joi-objectid
- Repository: https://github.com/mkg20001/joi-objectid
- Homepage: https://github.com/mkg20001/joi-objectid#readme
- Issues: https://github.com/mkg20001/joi-objectid/issues
- npm.io page: https://npm.io/package/joi-objectid

## Recent versions

- 4.0.2 (latest) — 2021-09-11
- 4.0.1 — 2021-09-11
- 3.0.1 — 2019-09-26
- 3.0.0 — 2019-09-26
- 2.0.0 — 2015-08-27
- 1.1.0 — 2014-12-10
- 1.0.0 — 2014-09-20

## README

# joi-objectid

A MongoDB ObjectId validator for Joi.

[![Build Status](https://travis-ci.org/mkg20001/joi-objectid.svg?branch=master)](https://travis-ci.org/mkg20001/joi-objectid)

## use

`joi-objectid` validates that the value is an alphanumeric string of 24 characters
in length.

It's used just like you'd use any other `Joi` type.

```js
const Joi = require('@hapi/joi')
Joi.objectId = require('joi-objectid')(Joi)

const schema = Joi.object({
  id: Joi.objectId(),
  name: Joi.string().max(100),
  date: Joi.date()
})

```

### Installation

```
npm install joi-objectid --save
```

### Development

#### running tests

- `npm test`

## License

[MIT](https://github.com/mkg20001/joi-objectid/blob/master/LICENSE)

---
_Source: https://npm.io/package/joi-objectid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
