0

I have the following requirement,where I need to fetch the data using the timestamp. The time stamp has Date and Time.I want to fetch only the Date.Please find the screen shot attached.I wrote the query as

db.General_Liability.aggregate({
    $project : {
        new_time_stamp : {$substr : ["$session.Datestamp",0, 2]}
    }
});

On querying the new time stamp is showing as empty.Please help me with this

enter image description here

sai
  • 61
  • 1
  • 10
  • what do you meant with "On querying the new time stamp is show as empty" , I think the projection should be 0,9, but I dont get your point of then query, you meant you have another aggregation operation in the pipeline ? – Koitoer Apr 19 '16 at 20:11
  • sorry to confuse you.I want to query the data based on the date.My datetime has both date and time.I used a substring to fetch only the date.The above query what i wrote is not throwing any error by new time stamp filed is shown as blank. – sai Apr 20 '16 at 01:16

0 Answers0