B4J Library Nitrite NoSQL embedded database library

I was interested to try Erel's MongoDB example in a few projects but really didn't want to use a server implementation so I looked for an alternative and found the Nitrite library.

This is a partial wrap of this github project Nitrite-java

The documentation is pretty good and is available here: Nitrite documentation. There is no support for the POJO repository.

Think of it as a KeyValueStore on steroids. You can search and sort records with filters. You can add fields to a record without having to change a schema.

Documents can be created directly from a Map, so if you use Maps to hold records internally you are already 80% of the way there.

The example application includes filtering and sorting the data which was imported from https://github.com/samayo/country-json.

1611756867782.png

Example applications depends on:
Example 2 depends on
  • Archiver
  • NitriteNoSQLDB-b4xlib v 1.10 (please download latest version)
Usage:
  • Download the b4xlib below and copy it to your AdditionalLibs B4x folder.
  • Download additional jars from my dropbox here. Unzip the file into your B4j additional libraries folder and leave them in the created nitrite folder.
  • Download a NitriteExample project.

NitriteNoSQLDB.xml contains the library documentation that you can view with one of the available library documentation viewers (Search the forum).

Update V1.10
  • Added CreateDocument3 to NitriteDocument_Static - Create an empty document
  • Added example 2 with Full CRUD example - Data imported from https://www.briandunning.com/sample-data/.
  • Updated documentation XML
Update V 1.15
  • Bug fix on Collection.UpdateMap4, only the b4xlib has been updated.

Let me know how you get on with it.
 

Attachments

  • NitriteExample.zip
    46.1 KB · Views: 361
  • NitriteNoSQLDB.xml
    95.5 KB · Views: 388
  • NitriteExample2.zip
    74.2 KB · Views: 366
  • NitriteNoSQLDB-b4xlib.b4xlib
    32 KB · Views: 156
Last edited:

stevel05

Expert
Licensed User
Longtime User
Update V1.10
  • Added CreateDocument3 to NitriteDocument_Static - Create an empty document
  • Added example 2 with Full CRUD.
  • Updated documentation XML
 

stevel05

Expert
Licensed User
Longtime User
To get started, I suggest that you read the Nitrite documentation. It is very well structured and you should find what you want.

Some of the class names in the library are different by necessity e.g.

Nitrite.builder is accessed using Nitrite_Static.Builder in the library

Filters are a powerful way of selecting data and accessed using the Filters Class -
B4X:
Dim F As Filters
F.initialize
F.Eq("FieldName","FieldValue")

etc. See the QueryDB Code Module in either of the examples.

There are also several other _Static classes that provide shortcut methods to initialize their related classes. (Open the NitriteNoSQLDB.xml file in an appropriate documentation viewer)

Events are not implemented on the basis that in a single user environment, you generally know when you are doing something that will trigger them. If you find that you do need them, I'll add them as and when.

If you find that anything else is missing that you need, let me know and I will look at adding it.
 
Last edited:
Top