# MongoError: docs parameter must be an array of documents (mongodb3)

**URL:** <https://discourse.nodered.org/t/mongoerror-docs-parameter-must-be-an-array-of-documents-mongodb3/18191>\
**Category:** General\
**Created:** [20 November 2019 11:02 UTC](https://discourse.nodered.org/t/mongoerror-docs-parameter-must-be-an-array-of-documents-mongodb3/18191 "2019-11-20T11:02:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtuiot](https://avatars.discourse-cdn.com/v4/letter/d/d6d6ee/32.png) [@dtuiot](https://discourse.nodered.org/u/dtuiot)\
**Post date:** [20 November 2019 11:02 UTC](https://discourse.nodered.org/t/mongoerror-docs-parameter-must-be-an-array-of-documents-mongodb3/18191/1 "2019-11-20T11:02:40Z")

</div>

Hi,

We're experimenting with storing data to a MongoDB. As it is now, we can store data on the database, but it seems like only the '_msg.payload_' is stored (as document) - and not the whole msg object.

The flow is very simple and nothing much has really been done.

 ![06](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/301457f62b0913b7ee18345ac60ecf1252b54a6e.png)

We wish to store **payload** but also **metadata** as a document to our collection on our database. We've tried searching for an answer to this, but couldn't find anything relevant on how to do this.

Hopefully we can get some help on this forum. Thanks in advance!

btw. we're using mongodb3 to store data!

 ![37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b90e0eb16e7f7991992bbfaace9db6ca04fd3b1c.png)

---

<div class="post-metadata">

**Author:** ![kushan-athukorala](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kushan-athukorala/32/21830_2.png) [@kushan-athukorala](https://discourse.nodered.org/u/kushan-athukorala)\
**Post date:** [16 May 2020 05:19 UTC](https://discourse.nodered.org/t/mongoerror-docs-parameter-must-be-an-array-of-documents-mongodb3/18191/2 "2020-05-16T05:19:08Z")

</div>

As per the documentation of the mongodb3 node you should embed within an array.

> **[ozomer/node-red-contrib-mongodb2](https://github.com/ozomer/node-red-contrib-mongodb2)**
>
> MongoDB driver node for Node-RED. Contribute to ozomer/node-red-contrib-mongodb2 development by creating an account on GitHub.

  
If you want to pass a single parameter WHICH IS AN ARRAY (eg as with `InserMany` ), wrap your array in an outer array: `msg.payload` = `[[{_id: 1243}, {_id: 2345}]]`
