Hello

Hello,
Does anybody know here whether there is a way to embed a MongoDB into iOS and/or Android?
I know that with Delphi/C++Builder you can use MongoDB for desktops.
But what about cross-platform MongoDB?
Even if for certain cases, that would be non-sense since MongoDB is aimed at storing documents, which can turn into cumbersome and huge DB. But still, for small PDFs, pictures, that would allow avoiding a backend server and stay embedded and would be a workaround on using blobs intensively instead (for the docs/images).

Thanks for any clue.

Comments

  1. Thanks all, I currently DO use SQLite for most of my devs. But for document management oriented apps, it seemed to me that MongoDB would be more appropriate.
    Regarding the link provided, it seems to me that it doesn't talk about embedding MongoDB inside a smartphone/iPad, it requires an outside server where MongoDB runs as a service.

    ReplyDelete
  2. Some StackOverflow responses say that the MongoDB memory modal isn't really suitable for Android. It does mention using this though https://github.com/couchbase/couchbase-lite-android However, if a document storing database is defined as "Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents." What you should do is have 1 SQLite database with 1 Table that has a Key column and a Value column. The Value column should be of type ftMemo (which probably maps to TEXT). Then what you do is you use a TFDMemTable and SaveToStream() with sfJSON and save it into the ftMemo field. docwiki.embarcadero.com - FireDAC.Comp.DataSet.TFDDataSet.SaveToStream - RAD Studio API Documentation Now you have an SQLite database with a key value lookup table and as many nested JSON values as you want. You can nest FDMemTables inside FDMemTables as well using the same method. FireDAC also does nested datasets natively ( http://docwiki.embarcadero.com/CodeExamples/Tokyo/en/FireDAC.TFDMemTable.NestedDataSet_Sample )but I feel like the JSON way is more portable.

    ReplyDelete
  3. I would never let a phone app talking to the DB, SQL or NoSQL. But define some REST service to talk with, publishing the use cases of the application (i.e. the screens and workflows). And put most logic (even the workflow itself) on the server side. Therefore, 1. you may fix bugs even without changing/debugging/signing/publishing a new version of the app; 2. you will be able to unit-test the system; 3. it will reduce coupling of the UI and the logic; 4. you may be able to quickly write a desktop program or a web site from the very same logic; 5. it will ease maintenance of the whole project

    ReplyDelete

Post a Comment