MongoDB replaceOne

I'm sorry but I've going round in circles...I wanted to replaceOne() with MongoDB but there's not that option in the ReTool UI, so I thought wrap it in a bulkWrite. But no matter what I do I can't seem to get past a "must be Valid JSON" error.

My current iteration is to forget replaceOne and try deleteOne, followed by insertOne but still get the same errors:
[{deleteOne:{ "_id": {{BTID}} }},{insertOne:{
{{BT}} }

BTID is an ID and BT is the object document that are getting populated when the query is called.

As an aside, it would be really helpful if we could copy & paste from the console!

Hey @mawdo81!

These are the MongoDB methods we support:

Which means deleteOne and insertOne should both work!

Would you mind sharing a screenshot of your current delete and insert query/queries?

I wonder if its how I'm passing the values in?

Ah, it looks like your UpsertMongoXeroTransactions query is a bulkWrite query. Since you're triggering this query for each item, you actually might want to just try using a single write query.

For example, you could trigger a deleteOne query and then add a Success handler to that deleteOne query to run an updateOne query! These two queries work for me:

1 Like