Sabaoth is the transliteration of tsavaot, which is the plural form of the hebrew word tsava. This word is the denominative of the verb tsiva, which means “go into battle, fight”
When taken as a noun, it means the units that go into battle and fight, and thus it can refer to armies, companies, groups of men that are going into battle.
From that basic militaristic usage you can form metaphors that give rise to other meanings. E.g. when I say "I will send a brigade of lawyers to your door", I don't mean that the lawyers are part of a military unit sent to kill you. What I do mean is that those lawyers are there to attack you in some metaphorical sense. There is a militarism to my choice of the word "brigade of lawyers" that is not present if I merely said "group of lawyers", but nevertheless the sense of this usage is as a collection, not an actual military unit.
Now if that phrase "brigade of lawyers" becomes commonly used over time, that militaristic aspect can fade from consciousness and people might come to think of it more as "group of lawyers". For example, "a troop of boyscouts" or "Salvation Army" have pretty much lost any militaristic connotation, but when these terms were first coined, that sense was intentionally there as both groups had a militaristic nature. Over time, these things are forgotten and today, one might argue that "troop" has an alternate meaning of "group of boyscouts" and thus is a generic word for "group". This type of semantic drift is especially true with something like a Bible translation, especially the KJV that shaped the English language. Many metaphors used in the KJV have become so common and have been used in so many other contexts that the original context has been lost and people forget that they are metaphors. The KJV changed the meaning of the words themselves so that phrases like "the array of heavenly hosts" have lost their militaristic connotation to modern readers, but the original author of the Bible as well as the King James translators certainly intended to include this connotation when they used military language to describe the groups of stars/angels. In the case of stars, the idea is (most likely) that they are marching in formation and/or deployed to their positions as commanded by their general, the Creator.
In this sense, some believe that tsavaot does not carry a militaristic sense but is just a generic word for collection or group. For these people, "Jehovah Sabaoth" just means "the Lord of Collections [of men/angels/stars]". But this is incorrect. The meaning is "Lord of Armies", or "The Lord that Leads us into battle" or "The Lord that fights for me" -- and we can see this from the Hebrew usage in the OT:
Use of YHWH Sabaot in the book of 1 Samuel:
1 Sam 1.11 -- To avenge the affliction of the handmaid Hannah, who is in bitterness of soul after being taunted for being barren.
1 Sam 4.3 -- To help in battle with the Phillistines
1 Sam 15.1 -- Before waging war on the Amaleks
1 Sam 17.45 -- When David fights Goliath
This is certainly the sense in the passage cited in James, where James is threatening those who withhold wages by appealing to Jehovah Sabaoth -- the God that will fight on behalf of those who are being oppressed.
This is the avenging God. If you erase that militaristic connotation, then you erase an important part of the meaning of the word, and you make the choice of James' language much more mysterious than it needs to be. There is nothing mysterious about Sabaot -- it means that God will fight for those who are being robbed and is supposed to invoke fear in the heart of employers.
 Ringgren, H. (2003). צָבָא. G. J. Botterweck & H.-J. Fabry (Eds.), D. W. Stott (Trans.), Theological Dictionary of the Old Testament (Revised Edition, Vol. 12, p. 211). Grand Rapids, MI; Cambridge, U.K.: William B. Eerdmans Publishing Company.which has a primary meaning "army" or other military unit (e.g. company, etc).