Data API Filter[ And, OR]


as far as i know from the document of Mongodb( you can use query to filter data. However, what is the correct syntax to do this using Data API as i will get response in retrofit in kotlin how can i handle the filter as i need to use AND OR queries.

Thank you.

Hi @laith_ayyat,

Why not use directly the Realm Kotlin SDK if you are doing a mobile app or directly the Java Driver if that’s not the case? I think this would simplify the code a lot.

The Data API takes query just like the find() command so there are no tricks really. $or and $and would work as usual as far as I know.


If i need to make an E-Commerce application, as far as i know i would need a Node.js application that would be on a server? then i would hit on the server ip. Unless i am wrong, is it ok to make a full application using the Realm SDK directly ?

Well it really depends but it can be OK.

Either you do a “standard” 3 tiers app with front-end + back-end + DB. So for example this could be React + Node.js (Next.js & MDB Node.js driver) + MongoDB.

Or you can design an app using a Realm SDK + an app in the Atlas App Service (was called Realm) + MongoDB.

The App in the Atlas App Service will act as a backend service (auth, rules, functions, triggers, …) but you can have a direct access to MDB from the SDK. It’s up to you then if you want to call mdb command directly from the front or encapsulate this in a back-end function (for security or just to factorise the code so it’s easier to update the front-end for example - it can be tricky if it’s a mobile app).