1. 몽고디비에서 0~1사이의 Random 데이터 생성 (50만건)

for(i=0; i<500000; i++) {
db.test.insert({"seq" : i,"random": Math.random(), "date": new Date() }); 
}

2. R 에서 rmongodb 패키지 사용해서 plot 찍기 (10건 : limit=10L)

library(rmongodb) 
mongo <-mongo.create(host="-- HOST IP --", name="",username="", password="", db="test")
if (mongo.is.connected(mongo)) {
    buf <- mongo.bson.buffer.create() 
    query <- mongo.bson.from.buffer(buf)
    cursor <- mongo.find(mongo, "test.test", query, limit=10L)
    # Step though the matching records and display them
    while (mongo.cursor.next(cursor)) { 
     a<- mongo.bson.to.list(mongo.cursor.value(cursor))
    print(a$seq)
    print(a$random)
    plot(a$seq,a$random,xlim=c(0,10),ylim=c(0,1))
    axis(1,at=seq(0,10,1))
    axis(2,at=seq(0,1,0.1))
    par(new=T)
    }
}

결과 확인