Currently, everything that I've read indicates that you must run MongoDB as a separate process/service. Is there any way to host MongoDB in-process? If not now, are their known plans to implement such a feature?
-
I'd be interested to hear why you want to run MongoDB in process... What is your use case? – David J. Feb 09 '10 at 18:34
-
Can you clarify what you mean "hosted in process"? – Brian Armstrong Mar 20 '10 at 06:17
-
Not hosted in a separate process boundary - in other words, I want to host the MongoDB service inside the application that uses MongoDB as its data store. – Jordan Mar 23 '10 at 14:39
-
9The obvious use-case is a system where there is a single process accessing the data store, and one wishes to eliminate the network overhead, latency, and/or complexity from the architecture. – Mark May 20 '10 at 19:48
4 Answers
Based on my experience with MongoDB and my skimming of the issue tracker tickets at http://jira.mongodb.org/browse/SERVER, I don't know of any way to host MongoDB in process. I also found no evidence of future plans to do so.
I would recommend asking this question on the mongodb-user mailing list: http://groups.google.com/group/mongodb-user

- 31,569
- 22
- 122
- 174
You could use the Embedded MongoDB library, although it was designed for unit testing purposes.

- 27,743
- 15
- 106
- 143
MongoDB is GNU AGPL licensed so if you include (link) in your application then the source of that application will also be GNU AGPL licensed. You can of course launch MongoDB from your application at startup and terminate MongoDB again when the application stops.

- 25,221
- 5
- 36
- 49
Another Stack Overflow question has answers relevant to this question.
Embedded MongoDB when running integration tests
Specifically, it mentions an in-memory MongoDB for the JVM named Fongo.
Looks like Fongo is mainly for integration tests and/or learning. It may not handle all Mongo use-cases, but is worth a look.

- 1,309
- 15
- 27