Naked JSON, nosql db or sqlite for Android and web applications (possibly iOS) for task management

Sorry for my English, this is not my native language.

I want to develop an application using this basic function:

  • The user can create tasks with subtasks. The level of hierarchy should be unlimited, therefore subtasks can have subtasks, etc.
  • The user can create tags, and each task can have an unlimited level of tags, so the user can view all tasks marked with tags.
  • Tasks must sync with the cloud.
  • It should work fast. So, for example, the user will not experience any lag in the transition to the next level of tasks or display items with different tags.

Well, there are many other features, such as reminders and more, but this is not related to this choice of bare JSON, nosql db or sqlite.

The question is, which is more suitable for this function?

For instance:

  • In sql, we will need to store the subtask identifiers somewhere in the schema and make O (n) queries for the n hierarchy level, but this is pretty easy in json. We can have a task object with an array of tasks, which is its subtasks. Or in xml (I don't know if this can be done in JSON), we could just have an array of some subtask identifiers), probably. What should I choose, what do you think?
  • In JSON, I can have string elements called a "tag". And all tasks can have an array of tags, quite simple. In sql, I would have to have another β€œtag” in the table, in which there would be all tags and all task identifiers for each unique pair of tags and identifiers that are redundant.
  • Syncing with the cloud is easy with JSON. I could just have one big file with all the tasks and upload it from the server or to the server, depending on where the last changes were (well, basically). But there are two problems. But in this way I would iterate over the entire file, while there were very few changes, and thus the application should consume more traffic. Maybe noSQL DB can solve this? In sql again, the application can also do this, but it will have to translate all the db data.
+4
source share
4 answers

Here are some ideas -

couchDB is considered a good type of keystore for replication on multiple servers / clients. This is probably the appropriate database type for the problem being described.

Otherwise, your script will use any SQL / noSQL style database with a REST access point. I think MongoDB is a particularly good choice because, despite the fact that it stores the key / value, it quickly learns from someone from the SQL word - it also returns the answers to your queries in json, so if you using something like NodeJS as your REST server can make things easier.

Regarding the general structure of your application - look at the docs for asana at http://developer.asana.com/documentation/ - it should give you a good start point.

0
source

Couchbase Lite is NoSQL's built-in database for iOS and Android. It stores JSON documents and transparently synchronizes them using cloud servers on other devices with a security model designed for fine-grained access control in multi-user interactive applications.

Github repositories:

Mailing list here: https://groups.google.com/forum/#!forum/mobile-couchbase

+1
source

Since this has not yet been proposed, SnappyDB has a very simple API and is a NoSQL database for android. It can save any object (says website). It is used like that

try { DB snappydb = DBFactory.open(context); //create or open an existing databse using the default name snappydb.put("name", "Jack Reacher"); snappydb.putInt("age", 42); snappydb.putBoolean("single", true); snappydb.put("books", new String[]{"One Shot", "Tripwire", "61 Hours"}); String name = snappydb.get("name"); int age = snappydb.getInt("age"); boolean single = snappydb.getBoolean("single"); String[] books = snappydb.getArray("books", String.class);// get array of string snappydb.close(); } catch (SnappydbException e) { } 

Saving a serializable object:

 AtomicInteger objAtomicInt = new AtomicInteger (42); snappyDB.put("atomic integer", objAtomicInt); AtomicInteger myObject = snappyDB.get("atomic integer", AtomicInteger.class); 

Saving any object:

 MyPojo pojo = new MyPojo (); snappyDB.put("my_pojo", pojo); MyPojo myObject = snappyDB.getObject("non_serializable", MyPojo.class); 
0
source

ThingDB is a NoSQL embedded database with the MongoDB API:

 DB db = new DB("./db"); Doc doc=new Doc(); doc.put("name","test"); doc.put("age",31); db.insert(doc); //later you can find the saved doc: Doc d=db.findOne(eq("name","test")); 

You can also convert the document to org.json.JSONObject:

 JSONObject jo=d.toJSONObject(); 

https://github.com/neo-expert/thingdb

0
source

Source: https://habr.com/ru/post/1497184/


All Articles