use SAMPLE_embed db.label.insertMany ([ {first_label: 'a', second_label: 'a', label_id: 1, hit_list: [ {color: "red", hits: 1, hit_time: '2000-01-01'}, {color: "red", hits: 10, hit_time: '2010-01-01'} ] }, {first_label:'a', second_label: 'b',label_id: 2, hit_list : [ {color: "green", hits: 2, hit_time: '2002-02-02'}, {color: "green", hits: 20, hit_time: '2012-02-02'} ], }, {first_label:'a', second_label: 'c',label_id: 3, hit_list : [ {color: "blue", hits: 3, hit_time: '2003-03-03'}, {color: "blue", hits: 30, hit_time: '2013-03-03'} ] }, {first_label:'b', second_label: 'b',label_id: 4, hit_list: [ { color: "red", hits: 4, hit_time: '2004-04-04'}, { color: "red", hits: 40, hit_time: '2014-04-04'} ] }, {first_label:'b ', second_label: 'c',label_id: 5, hit_list: [ {color: "green", hits: 5, hit_time: '2005-05-05'}, {color: "green", hits: 50, hit_time: '2015-05-05'} ] }, {first_label:'c', second_label: 'c',label_id: 6} ] ); db.label.createIndex({label_id: 1});