Skip to content
Advertisement

TypeError: unsupported operand type(s) for &: ‘list’ and ‘QueryInstance’

I am trying to have a login system where user input will be crosschecked with tinydb’s json file. I managed to get the registration working but when I try logging in I got this error.

TypeError: unsupported operand type(s) for &: ‘list’ and ‘QueryInstance’

I tried removing password verification and it worked. Not entirely sure the reason behind it. Would be great if I can receive some guidance as to what went wrong. Thanks!

JavaScript

Advertisement

Answer

It should have been and not &. The operand and will check both the conditions that you are trying to validate whereas & does a bitwise AND and it doesn’t like the types of data provided for the bitwise AND, hence the error.

Advertisement