You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the only way I could find to do this in surreal is through scripting: SELECT *, function() {return this.edits.reduce((a, b) => Object.assign(a, b))} AS edit FROM posts
But I believe the JS function performance is not as good as builtin functions for large dataset.
I think it's not even possible in custom functions because there is no object::assign.
Describe the solution
object::merge([]) function can do this.
Alternative methods
array::reduce() with object::assign() can also be used. both of these are helpful no matter object::merge exists or not.
SurrealDB version
1.1.1 for macos on aarch64
Contact Details
No response
Is there an existing issue for this?
I have searched the existing issues
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
We store incremental updates of a row in an array and use $mergeObjects operator in mongodb to merge them:
https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/
the only way I could find to do this in surreal is through scripting:
SELECT *, function() {return this.edits.reduce((a, b) => Object.assign(a, b))} AS edit FROM posts
But I believe the JS function performance is not as good as builtin functions for large dataset.
I think it's not even possible in custom functions because there is no object::assign.
Describe the solution
object::merge([]) function can do this.
Alternative methods
array::reduce() with object::assign() can also be used. both of these are helpful no matter object::merge exists or not.
SurrealDB version
1.1.1 for macos on aarch64
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: