Query management for mobile applications

Hello,
I’m working on an Android app and I’m facing some questions about query management …

Indeed, when I write the code on Android studio is it necessary to write the entire code of application there with all queries??

If some queries must be written on Mongodb server, where precisely it’s done… ??

Thank you all…