These are chat archives for deployd/deployd

7th
Sep 2016
hammadfauz
@hammadfauz
Sep 07 2016 05:26
Is there a way to access (sort by, actually) the mongoDB internal fields using dpd? I want to sort a collection by date created.
hammadfauz
@hammadfauz
Sep 07 2016 06:10
I have looked at $sort. By default, deployd does not seem to expose the creation date of the document. I was wondering if there was a way to get that
thbl
@thbl
Sep 07 2016 06:13
@hammadfauz hmm didden't know mongodb had a creation date by default ?
i just do a on post ....
this.creationDate = new Date().getTime() - 1000
gives the current unix epoc time
hammadfauz
@hammadfauz
Sep 07 2016 06:17
I thought I heard/saw it somewhere, about the creation date by default.
But I googled, it says creation dates are embedded into ids. So if I sort by Id, it will be sorted by creation date
thbl
@thbl
Sep 07 2016 06:34
@hammadfauz mmm see that, do i can't seam to find a fuction that converts it to a timestamp correctly :worried:
Can you convert id to timestamp /date ?
thbl
@thbl
Sep 07 2016 07:52
@rgolea
on the "on aftercommit" in collection can't i see what kind of request it is some how ? tried out
if(event === "POST"){
console.log("this is a post")
}
works in on berfore request but not on aftercommit :/
hammadfauz
@hammadfauz
Sep 07 2016 07:54
try ctx.method === 'POST'
thbl
@thbl
Sep 07 2016 07:55
@hammadfauz nice thanks :)
thbl
@thbl
Sep 07 2016 09:51
i can't get this to work in the usercollection aftercommit
emit(dpd.users, {company: this.company, role:0}, 'tempusers:create', this.id);
it works in other collections but in usere collection it only works if i remove dpd.users.....