scientisst_db 0.0.1 copy "scientisst_db: ^0.0.1" to clipboard
scientisst_db: ^0.0.1 copied to clipboard

outdated

Simple and powerful NoSQL document-based local database.

scientisst_db #

Pub

Open source Flutter plugin that implements a NoSQL document-based local database. The syntax of this package is similar to others well-known databases, organizing its data in collections and documents.

Made by the ScientISST team.

Installation #

dependencies:
  flutter:
    sdk: flutter
  scientisst_db: ^0.0.1

Architecture #

![Architecture scheme](https://raw.githubusercontent.com/scientisst/scientisst_db/master/doc/scientisst_db_scheme.png

The database stores data in the Applications Documents Directory, provided by path_provider. The database directory is stored in a root folder called scientisst_db. The first layer is constituted only by collections, which have their corresponding directory. Each collection directory is constituted by three separte folders: collections, documents, and metadata. The collection children documents are stored in the documents folder, where each document has its separate file with a filename corresponding to its ObjectId. The ObjectId is generated according to MongoDB's standard or can be an arbitary String. The document data is stored in a JSON formatted text file. Each document has a corersponding metadata file which is stored in the metadata folder inside the collection diretory, with a filename equal to the ObjectId, encoded also in the JSON format. A document can store collections (sub-collections), which are stored in a folder inside the collections directory under the parent collection directory. This folder has the same filename as the document ObjectId and it follows the same collection structure.

Examples #

See the full example here. Some basic examples:


Add a document to a collection:

DocumentReference doc = await ScientISSTdb.instance.collection("movies").add(
  {
    "title": "Eternal Sunshine of the Spotless Mind",
    "year": 2004,
    "characters": [
      "Joel",
      "Clementine",
    ],
  },
);

Update a document:

await doc.update(
  {
    "title": "Hello world",
  },
);

Delete a document:

await ScientISSTdb.instance.collection("movies").document("507f1f77bcf86cd7994ca120").delete();

Get all documents from a collection:

await ScientISSTdb.instance.collection("movies").getDocuments();

Order documents by field value:

await ScientISSTdb.instance
    .collection("movies")
    .orderBy("year", ascending: false)
    .getDocuments();

Future #

  • Add parallel "database" for storing Files;
  • Add Stream of List<DocumentSnapshot> to collection so the user can watch for changes in the collection documents;
  • Add a Query to limit the collection to the first N elements;
  • Improve the Exceptions thrown.

If you have any suggestion or problem, let us know and we'll try to improve or fix it.

License #

GNU General Public License v3.0, see the LICENSE.md file for details.

13
likes
0
pub points
30%
popularity

Publisher

verified publisherscientisst.com

Simple and powerful NoSQL document-based local database.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path_provider

More

Packages that depend on scientisst_db