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

Publish document version as ETag header #5

Open
erik-stephens opened this issue Jun 11, 2013 · 1 comment
Open

Publish document version as ETag header #5

erik-stephens opened this issue Jun 11, 2013 · 1 comment

Comments

@erik-stephens
Copy link

Summary

As a consumer of an API, I would like the service to publish appropriate cache headers, so that I can leverage caches & minimize resources.

Notes

MongoDB's automatic document versioning seems like a perfect fit for the ETag header. Sophisticated API clients could leverage that by including appropriate If-None-Match headers in their requests.

This should also allow for more effective caching at the server level. Should be able to drop in caching proxies between the API and its clients to reduce load.

Acceptance Criteria

  • GET requests without an If-None-Match header should include an ETag in the response. This is simply MongoDB's version number.
  • GET requests with an If-None-Match header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.
  • HEAD requests with an If-None-Match header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.
  • Should some simple sanity check should be performed against the client's version number? For example, if the client thinks they have version 4, but version 3 is the latest, should we return some sort of error response or just ignore it?

References

@yocontra
Copy link
Member

+1 /cc @ccowan @funkytek

As for the sanity check we should probably just ignore it. This also reminds me I need to strip the versionKey from incoming and outgoing bodies so people can't tinker with the cache

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