Add the ability to have Underscore in Intellishell
Underscore has lots of cool tools to manipulate arrays of results
-
Thomas (3T) commented
The easiest way to do this just now is to add underscore.js to your mongorc.js that you can specify on the "IntelliShell" tab of your application preferences.
That said, we have raised a ticket to configure IntelliShell to auto-load any number of scripts without having to go via mongorc.js -
Graeme Pyle commented
The actual problem I'm trying to solve is that I want an array of foreign keys to use in a new query. To get the foreign keys, I run
_.pluck( db.users.find(...).toArray(), "_id")
then I use that in an $in query.
Creating a group aggregation to do this takes too long. Is there a way I can easily copy the contents of a column into an array? That would be awesome.