How to get document before expiry using TTL

I already created document which set TTL for 15 minutes, I want to get all those documents which expire in next 15 min. Let consider following example first batch I inserted 100 documents at ( 10.00 AM ) which all having TTL expiry 15 minutes now I want to check at 10.13 AM or 10.15 AM how many document expir and moved that document into file. Couchbae server delete lazy documents so is possible to get all flagged deleted documents and write into file ?

yogesh, I’m sure this is not the most elegant way but you can use N1QL query to find the document expiry. You’ll have to do some other logic to filter out the documents you don’t want but this might help get you started:

SELECT meta().expiration FROM mybucket

Oh, glad to see you solved it in another post… Meta Query on TTL expiration fields