Skip to content

Publish document version as ETag header #5

@erik-stephens

Description

@erik-stephens

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions