#1 2014-05-07 07:13:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

MongoDB direct access and ORM/ODM integration with mORMot

MongoDB (from "humongous") is a cross-platform document-oriented database system, and certainly the best known NoSQL database.
According to http://db-engines.com in April 2014, MongoDB is in 5th place of the most popular types of database management systems, and first place for NoSQL database management systems.
Our mORMot gives premium access to this database, featuring full NoSQL and Object-Document Mapping (ODM) abilities to the framework.

Integration is made at two levels:
- Direct low-level access to the MongoDB server, in the SynMongoDB.pas unit;
- Close integration with our ORM (which becomes defacto an ODM), in the mORMotMongoDB.pas unit.

MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), which matches perfectly mORMot's RESTful approach.


This is the forum thread for our blog articles:
http://blog.synopse.info/post/2014/05/0 … ase-access
http://blog.synopse.info/post/2014/05/0 … ot-ORM-ODM
http://blog.synopse.info/post/2014/05/0 … -benchmark

Offline

#2 2014-05-07 08:02:21

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: MongoDB direct access and ORM/ODM integration with mORMot

Really nice work ! Could you elaborate on ACIDity or the best practices in your test against MongoDB ?
For example, this SO post says MongoDB is only ACID when writing a single record into a single table. http://stackoverflow.com/questions/7149890
For another example, the MongoDB FAQ says the "records/documents" do not need to have the same schema. Is this still so when used with mORMot ? http://docs.mongodb.org/manual/faq/fundamentals/

Last edited by ComingNine (2014-05-07 08:05:06)

Offline

#3 2014-05-07 08:08:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: MongoDB direct access and ORM/ODM integration with mORMot

Please read my blog article about this subject:
http://blog.synopse.info/post/2014/02/2 … bases-ACID
smile

If you use the ORM, the schema will be fixed at highest level.
But you can put ANY schema as sub-documents in any TPersistent, record, dynamic array or variant published properties.
See the TSQLORM record in the doc and BLOG articles. The data is stored as true BSON object or array in MongoDB document!
So you got the best of the two worlds.
big_smile

Offline

#4 2014-05-07 08:40:43

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: MongoDB direct access and ORM/ODM integration with mORMot

Very nice blog ! (Didn't see that in SAD v1.18 big_smile)

Thank you for your helpful comments !

Could you also help to comment on the pros and cons to use "SQLite and sharding" instead of "MongoDB" ? big_smile

Last edited by ComingNine (2014-05-07 08:41:28)

Offline

#5 2014-05-07 10:20:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: MongoDB direct access and ORM/ODM integration with mORMot

All those blog articles were part of the SAD 1.18 released.... yesterday evening!

SQlite3 + sharding is a pretty convincing option for true document-based work.
With TDocVariant published properties for instance, they are pretty powerfull.
Performance will be higher.
But with MongoDB you benefit from data replication, bigger database size, and all the BigData/NoSQL benefits of a proven external DB.
Remember that you can switch from SQLite3 + sharding to MongoDB + sharding at any time - even at runtime.

Offline

Board footer

Powered by FluxBB