---
title: "Discussion on \"Import a collection array to a document using MongoDB\" | Hashnode"
description: "Discussion on \"Import a collection array to a document using MongoDB\". mongoimport --db mydatabasename --collection collectionName --file my_json_file.json\n\nIf the collection is an array\nmongoimport --db mydatabasename --collection collectionName --file my_json_file.json --jsonArray"
url: "https://hashnode.com/posts/import-a-collection-array-to-a-document-using-mongodb/65831582203789be52d3c3a7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Import a collection array to a document using MongoDB](https://wcds.hashnode.dev/import-a-collection-array-to-a-document-using-mongodb?utm_source=hashnode&utm_medium=feed)

mongoimport --db mydatabasename --collection collectionName --file my\_json\_file.json If the collection is an array mongoimport --db mydatabasename --collection collectionName --file my\_json\_file.json --jsonArray

Dec 20, 2023 · 1 min read · wcds.hashnode.dev  
Updated Apr 1, 2024  
Read the article

-   [#mongodb](https://hashnode.com/tag/mongodb)

## Written by

[WellWCDS](https://hashnode.com/@wcds)

@wcds

  
[View profile](https://hashnode.com/@wcds)

Software Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
