How to export JSON from MongoDB using Robomongo

前端 未结 14 766
暗喜
暗喜 2021-01-30 01:37

So I do not know much about MongoDB. I have RoboMongo using which I connect to a MongoDB. What I need to do is this - there is a collection in that Mon

14条回答
  •  野的像风
    2021-01-30 01:56

    Robomongo's shell functionality will solve the problem. In my case I needed couple of columns as CSV format.

    var cursor = db.getCollection('Member_details').find({Category: 'CUST'},{CustomerId :1,Name :1,_id:0})
    
    while (cursor.hasNext()) {
        var record = cursor.next();   
        print(record.CustomerID + "," + record.Name)
    }
    
    Output : -------
    
    334, Harison
    433, Rechard
    453, Michel
    533, Pal
    

提交回复
热议问题