I switch to firebase 9 and want to achieve following
customers
-MomOdRNzkqr9vDk_MmE:"ptwXJ7JRAASFgd3KoS2fQyQhyV613"
-Myb3b_2W-7FTlsZvXCO:"QZOQ43DGYwfu4djlZ5EjEVksOr53"
I am trying the following
const customerSelectedRef = ref(db,`/serviceProvider/${user1.uid}/moneyCollector/customers`);
const customerSelectedRefPush = push(customerSelectedRef);
set(customerSelectedRefPush, customerSelected); // not wanted to use {customerSelected} which gives key value pair under push id
How could add value directly to push id?

The old method was
firebase
.database()
.ref(`/serviceProvider/${user1.uid}/moneyCollector/customers`)
.push(customerSelected)
.then(() => {
console.log("Data set.moneyCollector cutomer added");
checkdubArray = [];
});
Where push id acts as key for customerSelected
and I try to get same result in firebase 9.
Dont want the result which I have marked as cross
You can pass the string value directly in push() along with the DatabaseReference as shown below:
const customerSelectedRef = ref(db,`/service/${user1.uid}/Collector/customers`);
await push(customerSelectedRef , "string_value") // Not object
The result would be: