Category: Question and Answers

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Escaping {{ and or }} in value for mongo


I am experiencing an issue with my MongoDB database where the appsmith application is recognizing the {{}} in my config records and replacing them with null values. I have tried adding double-quotes around the values in my query and turning off Smart BSON Substitution, which works for update statements but not for insert statements. The app returns an Execution failed error with status 5005 when I use insert statements without Smart BSON Substitution, and replaces the values with nulls when I turn it on. I have shared my project with Amelia to demonstrate the issue.


The issue with the MongoDB database converting values with {{}} to null can be fixed by adding double-quotes around the values in the query and turning off Smart BSON Substitution in query settings. This fix works for update statements, but may cause issues when using insert statements. If an insert statement is used, Smart BSON Substitution should be turned on, but this may again result in the values being replaced with nulls. It is recommended to stick with using update statements with the above fix to maintain the correct values in the MongoDB database.