Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concatenation doesn't seemt to update the db. #71

Closed
blessanm86 opened this issue Nov 3, 2015 · 2 comments
Closed

Concatenation doesn't seemt to update the db. #71

blessanm86 opened this issue Nov 3, 2015 · 2 comments

Comments

@blessanm86
Copy link

Im not sure if im doing this wrong. I am just trying to concatenate 2 arrays with the below code

//This doesn't work
db('test').concat([3,4]);
db.save();

//This works
db('test').chain().assign(db.object.test.concat([3,4])).value();

Is this a bug? Is there a easier syntax then the second one?

@typicode
Copy link
Owner

typicode commented Nov 4, 2015

Not really a bug, it's because concat returns a new array instead of changing it:
https://lodash.com/docs#prototype-concat

Maybe an easier syntax:

db.object.test = db('test').concat([3, 4])
db.save()

@blessanm86
Copy link
Author

Oh OK. I get it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants