Thanks for your reply! As you mentioned , the insert clause is not executed as 
the results of args.map are never used anywhere, and after i modified the code 
, it works.


qinwei
 From: Tobias PfeifferDate: 2014-11-07 18:04To: qinweiCC: userSubject: Re: 
about write mongodb in mapPartitionsHi,

On Fri, Nov 7, 2014 at 6:23 PM, qinwei <wei....@dewmobile.net> wrote:           
 args.map(arg => { 
                coll.insert(new BasicDBObject("pkg", arg)) 
                arg 
            }) 

            mongoClient.close() 
            args  As the results of args.map are never used anywhere, I think 
the loop body is not executed at all. Maybe try:
            val argsProcessed = args.map(arg => {                 
coll.insert(new BasicDBObject("pkg", arg))                 arg             }) 
            mongoClient.close()             argsProcessed
Tobias



Reply via email to