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


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.

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!

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

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}]]