Skip to content

Database

Module to generate database related entries.

Overview

Traditional relational database tables have data organized in columns with specific types - column(), type(). The database usually has an engine() and a default collation() for sorting.

For the NoSQL database MongoDB, mongodbObjectId() provides a random ID.

collation

Returns a random database collation.

Available since v4.0.0

Returns: string

ts
function collation(): string;

Examples

ts
faker.database.collation() // 'utf8_unicode_ci'

column

Returns a random database column name.

Available since v4.0.0

Returns: string

ts
function column(): string;

Examples

ts
faker.database.column() // 'createdAt'

engine

Returns a random database engine.

Available since v4.0.0

Returns: string

ts
function engine(): string;

Examples

ts
faker.database.engine() // 'ARCHIVE'

mongodbObjectId

Returns a MongoDB ObjectId string.

Available since v6.2.0

Returns: string

ts
function mongodbObjectId(): string;

Examples

ts
faker.database.mongodbObjectId() // 'e175cac316a79afdd0ad3afb'

type

Returns a random database column type.

Available since v4.0.0

Returns: string

ts
function type(): string;

Examples

ts
faker.database.type() // 'timestamp'

Released under the MIT License.