I was wondering if it possible to using group (specifically, in the keyf function) to join 2 collections.
MYCOLL.collection.group(:keyf => "function(doc) { var var2Item=db.mycoll2.find({\"_id\":doc.my_sub_id}); var2=var2Item.join_var; return {'myreturn': doc.var1 + var2 }; }",
:initial => { :r => 0 },
:reduce => "function(doc,prev) { prev.r += +1; }",
:cond => {( ...my_conditions...)})
I have also tried
var2=doc.my_sub_id.join_var
and neither seems to work. I am using the Ruby Driver, but it is not really important, as the query is (practically) raw.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/YjCuh0Qr1OwJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
I don't think the db object is available witin the group, does it just output an error or nothing at all?
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/-3EW5Vr_MB8J.