[ key : { value1 : '123', value2 : '123' } ] 

instead

 [ { value1 : '123', value2 : '123' } ] 

    1 answer 1

    You get an invalid json:

     [ key : { value1 : '123', value2 : '123' } ] 

    I suppose you need to get all the same array:

     [ { "key" : { "value1" : "123", "value2" : "123" } } ] 

    Then you can use the map :

     db.test.insert({value1: '123', value2: '123'}) db.test.find().map(function(e) {return {key: e};} 
    • cool, thanks, got what you wanted - Yurii