B4J Library MongoDB - Documents database

Erel

Administrator
Staff member
Licensed User


MongoDB is one of the most popular NoSQL databases.
It is a nice and refreshing alternative to traditional relational databases (SQL databases).

Each represented entity is stored as a single document instead of being split into multiple tables.
Whether it will be better / simpler to use MongoDB compared to MySQL or a similar database server depends on the specific data.

Overall it is simple to start working with MongoDB and it is definitely a good tool to add to the toolbox.

At this point it is recommended to go over MongoDB manual: https://docs.mongodb.com/manual/introduction/

To start with MongoDB you need to:

1. Download and install: https://www.mongodb.com/download-center?jmp=docs
2. Create the default data folder (can be changed): c:\data\db
3. Run mongod from the command line.

In most cases you will use a three tier configuration where the clients access a B4J server and the B4J server communicates with the local MongoDB server.

I will post more examples next week. An example based on Alexa sites ranking data is available here:
www.b4x.com/b4j/files/MongoDBAlexaExample.zip
The data is loaded from a CSV file and then analyzed with different kinds of queries.

The library is attached.
It depends on three additional jars: www.b4x.com/b4j/files/mongodb-native.zip
Copy the library and the jars to the additional libraries folder.
 

Attachments

Last edited:

ShaneG30

Well-Known Member
Licensed User
After testing this out with the remote connector, I can say that this looks way easier than MySQL. I love the fact that the commands are created in the clients.
 
Top