Wednesday, 26 April 2017

How can I filter documentdb records based on timestamp?

I am using documentdb database since long,

thus it has lots of records/documents in collections,

No to simplify it I want to fetch records/documents based on timestamp.

  1. I want to fetch all records which are created in last 1 day.
  2. I want to fetch all records which are created in last 15 days.
  3. I want to fetch all records which are created in last 1 month.
  4. I want to fetch all records which are created in last 1 year.

I have tried to rite query like this but its not working.

var curDate = new Date().getTime();
SELECT * FROM r WHERE r._ts >= @curDate AND r.studentId=@studentId



via Piyush Dholariya

No comments:

Post a Comment