246866 (4) [Avatar] Offline
#1
Hi,

At the end of chapter 3 when we finally run the viewer.rb file to view the tweets I am getting the following error:
Mongo::Error::OperationFailure at /
Failed to parse: sort: [ "id", -1 ]. 'sort' field must be of BSON type Object. (9)


Screenshot: http://imgur.com/k1FUzLf

Any idea how to fix this?

PS: I took the source code from github.

Thanks
58555 (1) [Avatar] Offline
#2
The issue seems to be that they used square brackets around the sort parameter. Here is the code I used to get it to work:

@tweets = TWEETS.find(selector).sort({"id" => -1})


versus the original of

@tweets = TWEETS.find(selector).sort(["id", -1])


Hope this helps.

Wade