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
faker.database.collation(): string
faker.database.collation() // 'utf8_unicode_ci'

column

Returns a random database column name.

Available since v4.0.0

Returns: string

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

engine

Returns a random database engine.

Available since v4.0.0

Returns: string

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

mongodbObjectId

Returns a MongoDB ObjectId string.

Available since v6.2.0

Returns: string

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

type

Returns a random database column type.

Available since v4.0.0

Returns: string

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

Released under the MIT License.