Docs Menu

Docs HomeMongoDB Manual

cat()

On this page

  • Definition

Note

The native method listed here is for the legacy mongo shell.

To use native methods in mongosh, see Native Methods in mongosh

cat(filename,useBinaryMode)

Returns the contents of the specified file. The method returns with output relative to the current shell session and does not impact the server.

Parameter
Type
Description
filename
string
The filepath to open. The filepath must be on the local file system.
useBinaryMode
boolean

Optional. Flag to determine whether to open file in binary mode or text mode.

Applicable for Windows.

  • Specify true to open the file in binary mode.

    On Windows, opening the file in binary mode leaves the character '\n' as is.

  • Specify false to open the file in text mode.

    On Windows, opening the file in text mode converts the character '\n' to '\r\n'.

The default value is false.

New in version 4.0.5.

←  Native Methods in the Legacy Shellcd() →

On this page

Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.