Add new items to a list in mongodb

Consider this:
{"_id": “some unique id”,
" username": “hedisam”,
" followers": [“david”, “sam”]

How can I add a new follower to the followers list? PATCH action will remove the existing items from the list. Is it possible without a custom script?

Hey @hedisam, unfortunately I can’t really help you with custom scripting.

DreamFactory supports server-side scripting with Javascript, Node.js, PHP, and Python.

Overview documentation is at and There are links in the docs to a few blog posts that should also be helpful.


Hey @AlexBowen, Thanks for replying.

Actually I meant “Server Side Scripting”.

You would use a PUT instead of a PATCH.
Which means you would have to get the whole existing record, add your new followers to it, and then PUT the whole new record back into the DB.

MongoDB Patch operator will be supported in the future.

1 Like