0

Currently, I'm doing the update_all with concatenation like this:

collection.update_all(flag: false)
collection.update_all(["description = CONCAT(description, ?)", 'not_available'])

Is it possible to do it at once?

Obviously, this construction doesn't work:

collection.udpate_all(flag: false, ["description = CONCAT(description, ?)", 'not_available'])
megas
  • 21,401
  • 12
  • 79
  • 130

1 Answers1

1

update_all can take array, so you should be able to do something like this:

collection.udpate_all([
  "description = CONCAT(description, ?)", flag = ?,
  'not_available',
  false
])
nuaky
  • 2,036
  • 1
  • 14
  • 20
  • Two bind variables don't work for some reason. I came up with such solution `collection.update_all(['desc = CONCAT(desc, ?), flag = FALSE', 'not_available'])` – megas Nov 30 '20 at 10:43