crud-node
  • ⚡Overview
  • ✨Installation
  • 🧰Schema (soon)
  • ☄️Quick Start
  • Guides
    • 🪄Guides (soon)
  • Adapters
    • 💫Adapters
      • Availability 🆕
      • MySQL
      • MySQLX
      • Mongo (soon)
      • Postgres (soon)
      • Cassandra (soon)
      • Oracle (soon)
      • SqlLite (soon)
      • Couchdb (soon)
  • Reference
    • ⭐API Reference
      • Availability 🆕
      • init
      • toString
      • createDocument
      • createDocumentIfNotExists 🆕
      • deleteDocument
      • deleteAll 🆕
      • updateDocument
      • getDocument
      • getDocuments
      • getDocumentByCriteria 🆕
      • searchDocumentsByCriteria 🆕
      • searchDocuments 🆕
      • groupByDocuments 🆕
      • filterDocumentsByCriteria 🆕
      • filterDocuments 🆕
      • filterDocumentsByIds 🆕
      • fetchAll 🆕
      • findDocument 🆕
      • existsDocument
      • getCount
      • getTotal
      • callStoredProcedure 🆕
  • 📃Changelog
  • 📋Roadmap
Powered by GitBook
On this page
  1. Reference
  2. API Reference

toString

Returns a string that represents the current row.

toString is the formatting method in the crud-node. It converts a row to its string representation so that it is suitable for display.

The default implementation of the toString method returns the id of a document, and <unknown> if a document is not defined.

To override toString formatting, add to document schema toString method.

Signature

The same on all adapters

toString(document?: IDocument<S>): string;

Example

enum EmployeeProps {
  _id = '_id',
  lastName = 'lastName',
  firstName = 'firstName',
  ....
}

...

toString: (data: IDocument<EmployeeProps>) => {
    return `${data.firstName} ${data.lastName}`;
},
PreviousinitNextcreateDocument

Last updated 2 years ago

⭐