'How do I create an if statement with MongoDB

So I am creating a login system and want it to search for usernames and passwords within my cluster and if a username is found and the entered password matches it calls a certain function, however I am unsure of how to do this. My code is the following:



def login_user():
    username_data = username_confirmation.get()
    password_data = password_confirmation.get()
    login_username_entry.delete(0, END)
    login_password_entry.delete(0, END)

    accountParameters = { "username": username_data, "password" : password_data }

    findAccount = accounts.find(accountParameters)

Any help is incredibly appreciated :)



Solution 1:[1]

Just added one variable to collect the values and after the loop add them at once.

const groupInput1 = document.getElementsByName('glassLeistung');
 const output = document.getElementById('glassType');
 const go = document.getElementById('go');
 
  go.addEventListener("click", event => {
    const collectHere = [];
    for (let i = 0; i < groupInput1.length; i++) {
       if (groupInput1[i].checked) {
           console.log(groupInput1[i].value);
           collectHere.push(groupInput1[i].value);
       }
    }
    
    output.value = collectHere.join(' - ');
  })
<input type="checkbox" class="selected" id="glass" name="glassLeistung"
value="Glass" autocomplete="off">
                                                       
<input type="checkbox" id="rahmen" class="selected" name="glassLeistung"
value="Rahmen" autocomplete="off">
                                                       
<input type="checkbox" id="falzen" class="selected" name="glassLeistung"
value="Falzen" autocomplete="off">



<input type="text" name="glassType-420" value="" size="40"  id="glassType" aria-invalid="false">

<button id="go">go</button>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 n1md7