These are chat archives for Automattic/mongoose

2nd
Jul 2015
Daniel Marchena Parreira
@danielmapar
Jul 02 2015 06:36
hey guys, how can I make "query.where('loc').near({ center: [10, 10], maxDistance: 5 });" return the distance attr?
Kamran Riaz Khan
@krkhan
Jul 02 2015 18:12
Let's say I have a User schema like this:
'''
{
_id: ObjectId,
age: Number,
stories: [type: ObjectId, ref: 'Story']
}
'''
What would be the cleanest way of querying "5 stories from users with age > 20". Essentially, I'm trying to pass limit and skip to populate but that doesn't work. Right now I'm using my spaghetti code to find and populate the User model and then loop through the stories while honoring skip and limit.
Darn, backticks
{
_id: ObjectId,
age: Number,
stories: [type: ObjectId, ref: 'Story']
}