0

Here is the data from Mongodb.

[
         {
           '_id': ObjectId('5ae348f19268ff41a8e35170'),
           'commission': [
                            {'_id': ObjectId('5ae348f19268ff41a8e35170'),
                             'commission': [
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8a'), 'market': 'amazon_my', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8b'), 'market': 'amazon_sg', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2}
                                           ]
                            }
                         ]
         }
]

I would like to find, insert, delete, or update some of the data I want other than the whole data change. I've looked for several things, but I don't know how to do it effectively. Please help :)

____1. insert_data____

[
         {
           '_id': ObjectId('5ae348f19268ff41a8e35170'),
           'commission': [
                            {'_id': ObjectId('5ae348f19268ff41a8e35170'),
                             'commission': [
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8a'), 'market': 'amazon_my', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8b'), 'market': 'amazon_sg', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                     ---inserted data       {'_id': ObjectId('cae21c969268ff4118df7f8b'), 'market': 'amazon_th', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2}
                                           ]
                            }
                         ]
         }
]

____2. update_data____

[
         {
           '_id': ObjectId('5ae348f19268ff41a8e35170'),
           'commission': [
                            {'_id': ObjectId('5ae348f19268ff41a8e35170'),
                             'commission': [
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8a'), 'market': 'amazon_my', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8b'), 'market': 'amazon_sg', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                     ___updated_commision   {'_id': ObjectId('cae21c969268ff4118df7f8b'), 'market': 'amazon_th', 'commission': 88.0, 'commission_vat': 0.24, 'payment': 2}
                                           ]
                            }
                         ]
         }
]

____3. delete_data____

[
         {
           '_id': ObjectId('5ae348f19268ff41a8e35170'),
           'commission': [
                            {'_id': ObjectId('5ae348f19268ff41a8e35170'),
                             'commission': [
                                            {'_id': ObjectId('5ae21c969268ff4118df7f8a'), 'market': 'amazon_my', 'commission': 4.0, 'commission_vat': 0.24, 'payment': 2},
                                           ]
                            }
                         ]
         }
]

Thanks for reading:)

susim
  • 221
  • 5
  • 15
  • In case nobody has told you this here before, you ask **one** question at a time. All your questions are already answered anyway, which covers the other thing being "search for answers first" before you even post anything. I also suggest you read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and also take the time to look at some well received questions and answers as an example of what you should be submitting here. This really does not fit that brief. Thanks for listening – Neil Lunn May 02 '18 at 09:12
  • Thank you for your kind reply. As I am still a beginner and my English was poor. I'll refer to your answer to make it a little better. Thank you very much. – susim May 02 '18 at 09:41
  • All is good. Just pointing you to things you may not know yet. – Neil Lunn May 02 '18 at 09:43

0 Answers0