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

upsert function (update if exists and insert if doesn’t exists) #292

Open
idrenski opened this issue Jun 23, 2016 · 3 comments
Open

upsert function (update if exists and insert if doesn’t exists) #292

idrenski opened this issue Jun 23, 2016 · 3 comments
Labels

Comments

@idrenski
Copy link

idrenski commented Jun 23, 2016

Hello,
I want to develop upsert (update if exists and insert if doesn’t exists) function with the methods from express-restify-mongoose which works on server side. Any hints are welcome.

In general what is missing to me is documentation by examples.

Thanks in advance.

@Zertz Zertz added the question label Jul 8, 2016
@Zertz
Copy link
Collaborator

Zertz commented Jul 8, 2016

When working through an API, you usually know if an object exists or not. Do you have a particular use-case for upsert?

Indeed, we are a bit lacking in examples, this is definitely an area that needs work!

@Zertz Zertz closed this as completed Jul 8, 2016
@Zertz Zertz reopened this Jul 8, 2016
@idrenski
Copy link
Author

idrenski commented Jul 8, 2016

The use case is when you want to store user settings or user preferences. In most of the cases you simply want to store the actual data and don't care if have been exist or not until that moment. In this case upsert function is most convenient for the developer.

@Zertz
Copy link
Collaborator

Zertz commented Jul 12, 2016

Fair enough. The best I can offer you at the moment is to create defaults when said user signs up and then you don't have to worry about upserting.

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

No branches or pull requests

2 participants