How to Get Selection Id by parent and child item id of bundle product in Magento 2?

Out of the box Magento supports Bundle products, You can customize the item from the given option selection and add items to a single click of add to cart.

catalog_product_bundle_selection table used to store the bundle item’s relation with the child item id, option id, qty, position of the item and default item selection from the given option.

You can retrieve the selection id by the Bundle Item Id and Child Product id using database query in the function,

You can get the selection_id to passing the required parameter in the function,

Output:
2