How to add to existing field in an object instead of rewriting it?

For example, I have an array of objects called “log”. I need to add another object to this array without rewriting existing ones. Is getting all objects from this field using query and then pushing new object and saving it back the only solution to this?

For Array you can do obj.add('arrayField', 'some item')

1 Like

Worked like charm. Thank you!

Quick question regarding this topic. Will dumping hefty amounts of data in this array field (every hour or so) decrease overall server performance? Will querying be slow if every single object has it?

I would not use array to store data that grow and/or change a lot over time. It can cause serious performance issues. I’d use a class for that instead.