Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on solution for Assignment in Lesson01_Aggregation_Framework methods avg_family_time #3

Open
perecullera opened this issue Mar 28, 2016 · 3 comments

Comments

@perecullera
Copy link

No description provided.

@perecullera
Copy link
Author

the methods not collecting arguments and forcing match to match 'Jones'

@perecullera
Copy link
Author

`#

Lecture 5: $unwind

def avg_family_time last_name
@coll.find.aggregate([ {:$match=>{:last_name=>"JONES"}},
{:$group=>{:_id=>"$last_name", avg_time:{:$avg=>"$secs"}, numbers:{:$push=>"$number"}}}])
end

def number_goal last_name
@coll.find.aggregate([ {:$match=>{:last_name=>"JONES"}},
{:$group=>{:_id=>"$last_name", avg_time:{:$avg=>"$secs"}, numbers:{:$push=>"$number"}}},
{:$unwind=>"$numbers"},
{:$project=>{_id:0, :number=>"$numbers", avg_time:1, last_name:"$_id"}}
])
end
`

@ejavaguy
Copy link
Contributor

Wow -- good catch. That hard-coding of "JONE"s and bypassing the provided
last_name input parameter does not look right at all.

Likely a copy/paste from the Rails console without editing for use within
the method.

I will address -- thanks!

On Mon, Mar 28, 2016 at 10:29 AM, perecullera [email protected]
wrote:

`#

Lecture 5: $unwind

def avg_family_time last_name
@coll https://github.com/coll.find.aggregate([
{:$match=>{:last_name=>"JONES"}},
{:$group=>{:_id=>"$last_name", avg_time:{:$avg=>"$secs"},
numbers:{:$push=>"$number"}}}])
end

def number_goal last_name
@coll https://github.com/coll.find.aggregate([
{:$match=>{:last_name=>"JONES"}},
{:$group=>{:_id=>"$last_name", avg_time:{:$avg=>"$secs"},
numbers:{:$push=>"$number"}}},
{:$unwind=>"$numbers"},
{:$project=>{_id:0, :number=>"$numbers", avg_time:1, last_name:"$_id"}}
])
end
`


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants