These are chat archives for Automattic/mongoose

28th
Mar 2015
Liam Mitchell
@LiamKarlMitchell
Mar 28 2015 02:49

Hey, would anyone know how to use a value of a doc in the query such as

.find().where( 'created + ttl' ).lt( Date.now )

where created and ttl would both be part of the document.
Or should I generate ttl when I save as a timestamp in the future then just check that might be easier?

Liam Mitchell
@LiamKarlMitchell
Mar 28 2015 03:02

yeah I guess I will just do it like that.

what about having a tail-able query with an updating time component / comparing on server?

.where('ttl').gte('Get server side Date.now?')
Joseph Thibeault
@jrthib
Mar 28 2015 04:10
What was the reason for the organization switch of Mongoose from LearnBoost to Automattic?
I can’t find any press on it
Valeri Karpov
@vkarpov15
Mar 28 2015 20:39
@LiamKarlMitchell not quite sure what you mean, can you clarify a bit more?
Liam Mitchell
@LiamKarlMitchell
Mar 28 2015 20:41
@vkarpov15 ah sorry I wrote that when i was very tired it may not have came out the best
Valeri Karpov
@vkarpov15
Mar 28 2015 20:43
and @jrthib long story short, mongoose was IP that belonged to LearnBoost, which was renamed CloudUp, which was then acquired by Automattic, so technically mongoose has been owned by Automattic since 2013. I don't know why exactly 3/24/15 was the date to switch over but if you're looking for relevant press here it is: http://techcrunch.com/2013/09/25/automattic-acquires-file-sharing-service-cloudup-to-build-faster-media-library-and-enable-co-editing/
Liam Mitchell
@LiamKarlMitchell
Mar 28 2015 20:43
what I was wondering was how to query something using a value + something else in a compare
like in sql you might do WHERE date+lifetime > now()
but date and lifetime would be fields on the record
Valeri Karpov
@vkarpov15
Mar 28 2015 20:44
Not in a query. You can use the aggregation framework though, but I don't think you can use a tailable cursor with the aggregation framework
Liam Mitchell
@LiamKarlMitchell
Mar 28 2015 20:44
fair enough
i ended up doing it just in the client side js and its working fine, also just made the value i wanted when inserting rather than calculating it on query