Here David's wisdom is compared to the wisdom of an angel. Alternate translation: "my master the king is as wise as an angel of God" (See: [[rc://en/ta/man/translate/figs-simile]])
This means to do what you think is right. Alternate translation: "do what you believe to be the right thing to do" (See: [[rc://en/ta/man/translate/figs-idiom]])