These are chat archives for Automattic/mongoose

7th
Jul 2017
deathlover
@deathlover
Jul 07 2017 06:51

Hi,
following is the mongo response : {"created_at" : ISODate("2017-07-06T14:36:03.844Z") }
how to apply moment().fromNow() function efficiently.

Note : Don't want to use forEach() to loop through series of value and convert it, any patch which allows us to directly allow the moment function in raw query

Julio Borja Barra
@juboba
Jul 07 2017 09:27

Hey guys,
I'm trying:

db.getCollection('posts').find({ categories: { $elemMatch: { $in: [ '58a32c5a3708632a84c3cb1d', '58c28a536966070e44acfdef' ]}}})

Successfully, returns results, but using mongoose:

    Post.find({
      categories: { $elemMatch: { $in: [ '58a32c5a3708632a84c3cb1d', '58c28a536966070e44acfdef' ] } }
    })

I get 0 results, any ideas?