Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can mongodb be used as an embedded database?

I am working on a RSS reader application. And I need to find a backend database. I want the database be embedded because I don't want the users to install a database server.

I know SQLite is a good choice, but I am wondering if there are any other nosql choices?

like image 324
Bill Yan Avatar asked May 24 '11 19:05

Bill Yan


People also ask

What is embedded data in MongoDB?

Embedded Data Embedded documents capture relationships between data by storing related data in a single document structure. MongoDB documents make it possible to embed document structures in a field or array within a document.

Can MongoDB be used locally?

You can download and install MongoDB Compass from the this page. To connect to your local MongoDB, you set Hostname to localhost and Port to 27017 . These values are the default for all local MongoDB connections (unless you changed them). Press connect, and you should see the databases in your local MongoDB.

What is embedding and referencing in MongoDB?

Embedded documents are an efficient and clean way to store related data, especially data that's regularly accessed together. In general, when designing schemas for MongoDB, you should prefer embedding by default, and use references and application-side or database-side joins only when they're worthwhile.


2 Answers

(I don't yet have 50 rep points to comment on, and build upon, the accepted answer; otherwise I would, sorry!)

You can embed MongoDB in your OEM solution but there are two things to consider:

  1. It is written in C++, so if you are coding in a different language you might need to write a wrapper that launchers the database process separately.

  2. MongoDB is licensed under Gnu AGPL-3.0 which is a copy left server license. The accepted answer, and the Google group quote, both correctly state that this would normally force you to also be AGPL licensed. However, they MongoDb states that the intention of the license is to allow refinements to their code to be submitted back, and that your product will remain separate. This makes me think that the normal copy left rules don't apply.

The goal of the server license is to require that enhancements to MongoDB be released to the community. Traditional GPL often does not achieve this anymore as a huge amount of software runs in the cloud. For example, Google has no obligation to release their improvements to the MySQL kernel – if they do they are being nice.

To make the above practical, we promise that your client application which uses the database is a separate work. To facilitate this, the mongodb.org supported drivers (the part you link with your application) are released under Apache license, which is copyleft free. Note: if you would like a signed letter asserting the above promise please request via email.

Source: http://www.mongodb.org/display/DOCS/Licensing

like image 175
Steve McDowell Avatar answered Sep 28 '22 00:09

Steve McDowell


According to the Google Group, yes it can, but it doesn't cover how exactly.

Yes, but it isn't pretty and will force your app to be AGPL licensed. If you are interested take a look at how the tools handle the --dbpath option.

Source: http://groups.google.com/group/mongodb-user/browse_thread/thread/463956a93d3fb734?pli=1

If you're using .NET, one option might be RavenDB, which is a document database, and can be embedded.

like image 39
Joe Doyle Avatar answered Sep 28 '22 00:09

Joe Doyle