Search code examples
codenameone

Using MongoDB with CodenameOne


Is there a way to connect to a MongoDB Database from Codename One, and perform "CRUD" operations? I'm new to Codename One database implementation.


Solution

  • You shouldn't expose your database to the mobile tier. It would let anyone who has access to your application manipulate/corrupt your data. It would mean transactions can fail because of bad network connectivity.

    The way this should work is that you would create a server (e.g in Spring Boot or any other language). Expose a web service on said server and invoke that from the Codename One app. That Web Service will perform the CRUD operations.

    I go into this extensively in my courses: https://debugagent.com/series/cn1

    I use MySQL but all the same principals apply regardless of the technology.