More than one revision in view query


I’m getting more than one revision of the same document in a view query. Is this ever expected, and if so under what conditions? I don’t seem to have conflicts on the doc.

I have clipped the “errors” from the example below as they were quite long and included stack traces. Could putting this sort of thing in docs mess up the indexing of views?

curl http://localhost:4985/tasks/_design/queue_interplay/_view/tasks\?stale=false&limit=2&include_docs=true&conflicts=true

gives me

{ "total_rows":2, "rows":[ {"id":"task_37d3d7d0-dd2d-41ba-9d38-dbdedfb77218", "key":1.481300149161933e+09, "value":{ "_rev":"14-eba51d9520283e5f560eeef5afefb2e9", "channels":["interplay"], "errors": [ ... ], "func_name":"update_pathwatch", "kwargs":{"pathwatch_id":"pathwatch_1c839952-95b5-47de-b9dc-94368943ce79"}, "lease":1.481300149161933e+09, "lease_taken":1.481299549161933e+09, "namespace":"", "owner_name":"paulrave", "progress":0, "schema":"", "type":"task"} }, {"id":"task_37d3d7d0-dd2d-41ba-9d38-dbdedfb77218", "key":1.481307741990773e+09, "value":{ "_rev":"15-cb6920f83dfc4cf871e83cda7fdaf2a6", "channels":["interplay"], "errors":[ ... ], "func_name":"update_pathwatch", "kwargs":{"pathwatch_id":"pathwatch_1c839952-95b5-47de-b9dc-94368943ce79"}, "lease":1.481307741990773e+09, "lease_taken":1.481299549161933e+09, "namespace":"", "owner_name":"paulrave", "progress":0, "schema":"", "type":"task" } } ], "Collator":{} }

Guessing that indexing in floats is bad! I have changed to ints and it has gone away but this may just be due to forcing a re-index. I’ll see if it reappears.

Is the ‘id’ value emitted by your view the actual document key in the bucket, or your own id property? And was this a view created through Sync Gateway, or created manually on the server?

If it’s your own id and a manually created view, you might be seeing the temporary backup that Sync Gateway makes of previous revisions (stored as _sync:rev:docid:... in your view results. If so, you’ll need to modify your view to exclude documents beginning with ‘_sync’.

I think this is probably my fault.

It’s in a view created through the gateway and with the db document id, but it was in a db that I had done some violence to the night before and then forgotten to flush, and start again.

While testing some iPad app code I had deleted another document, that was indexed by this view, manually in the couchbase web interface. I do know this is something never to do, and I guess I this is one of the “bad things” than can then happen.

I’ll reset the db and see if it comes back. If it does I’ll document what happens in detail otherwise assume user error!