मैं पेमोंगो में मानचित्र-कमी के साथ अधिकतम uid
फ़ील्ड के साथ दस्तावेज़ कैसे प्राप्त करूं?मानचित्र के साथ अधिकतम मूल्य वाले दस्तावेज़ को कैसे प्राप्त करें-पिमोंगो में कम करें?
मैं कोशिश की है निम्नलिखित लेकिन यह पता प्रिंट कारतूस:
from pymongo import Connection
from bson.code import Code
db = Connection().map_reduce_example
db.things.insert({
"_id" : "50f5fe8916174763f6217994",
"deu" : "Wie Sie sicher aus der Presse und dem Fernsehen wissen, gab es in Sri Lanka mehrere Bombenexplosionen mit zahlreichen Toten.\n",
"uid" : 13,
"eng" : "You will be aware from the press and television that there have been a number of bomb explosions and killings in Sri Lanka."
})
db.things.insert({
"_id" : "50f5fe8916234y0w3fvhv234",
"deu" : "Ich bin schwanger foo bar.\n",
"uid" : 14,
"eng" : "I am pregnant foobar."
})
db.things.insert({
"_id" : "50f5fe8916234y0w3fvhv234",
"deu" : "barbar schwarz sheep, haben sie any foo\n",
"uid" : 14,
"eng" : "barbar black sheep, have you any foo"
})
m = Code("function() {emit(this.uid,{'uid':this.uid,'eng':this.eng})}")
r = Code("function (key, values) {var total = 0;for (var i = 0; i < values.length; i++) {total += values[i];}return total;}")
result = db.things.inline_map_reduce(m, r)
for r in result:
print
एक उदाहरण दस्तावेज है कि इन की तरह लग रहे:
{
"_id" : ObjectId("50f5fe8916174763f6217994"),
"deu" : "Wie Sie sicher aus der Presse und dem Fernsehen wissen, gab es mehrere Bombenexplosionen mit zahlreichen Toten.\n",
"uid" : 13,
"eng" : "You will be aware from the press and television that there have been a
number of bomb explosions and killings."
}
बीटीडब्ल्यू, 'बार्बर ब्लैक भेड़, क्या आप किसी भी foo' जर्मन में 'barbar schwarzes Schaf, hast du etwas foo' होगा। – luckydonald