SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

_etag not being returned for all docs in a collection #20

Closed rbarcelos closed 9 years ago

rbarcelos commented 9 years ago

Hi,

I am using RestHeart to load all docs in a given collection from MongoDb. _etag is being returned randomly only for few docs ..

capture

You can try it out using the following url also:

http://104.236.128.68:8080/WallTrade/fb_group

ujibang commented 9 years ago

Just to confirm: has the document 11 in your screenshot been created by RESTHeart or by a different client?

In fact, the _etag property is injected by RESTHeart at write time.

If a document has been created by a different client (e.g. mongo shell) the _etag won't be there. In this case RESTHeart won't enforce the etag match. At first update by RETHeart, the _etag will be automatically added.

rbarcelos commented 9 years ago

Gotcha.. You are right.. the ones missing got created by a different client.. could you make this clear on the documentation ?..

Thanks

Rafael Ferreira Barcelos M.Sc. in Software Engineering at COPPE/UFRJ

Software Development Engineer at Microsoft

On Tue, Mar 24, 2015 at 1:09 AM, Andrea Di Cesare notifications@github.com wrote:

Just to confirm: has the document 11 in your screenshot been created by RESTHeart or by a different client?

In fact, the _etag property is injected by RESTHeart at write time.

If a document has been created by a different client (e.g. mongo shell) the _etag won't be there. In this case RESTHeart won't enforce the etag match. At first update by RETHeart, the _etag will be automatically added.

— Reply to this email directly or view it on GitHub https://github.com/SoftInstigate/restheart/issues/20#issuecomment-85390342 .

ujibang commented 9 years ago

yes indeed. the docs will have a section full dedicated to the ETag

work in progress! http://restheart.org/docs/etag.html