How to send multiple documents using RMongo
问题 I am following the conventions from http://docs.mongodb.org/manual/reference/method/db.collection.insert/ to send a batch of multiple documents in one call of RMongo::dbInsertDocument. data=data.frame(A=c(1,2),B=c(3,4)) L=lapply(split(data,rownames(data)),as.list) names(L)=NULL dataJSON = toJSON(L) cat(dataJSON) which gives the following result: [ { "A":1, "B":3 }, { "A":2, "B":4 } ] Then dbInsertDocument(rmongo.object=myRmongo.object, collection=myCollection, doc=dataJSON) returns the