exportFile() - Export JSON documents to a file command

Exports JSON documents from a collection into a file.

Syntax diagram

Read syntax diagramSkip visual syntax diagramdb.collection. exportFile(file_name)

Command parameters

file_name
This parameter specifies the fully qualified name of a file from which to export data.

Example

Export the books collection from the books.js file:
db.books.exportFile("C:\\books.js")
Sample output is as follows:
28 objects were exported in 200 milliseconds.