| 1 |
DB_MONGODB Module |
| 2 |
|
| 3 |
Daniel-Constantin Mierla |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Edited by |
| 8 |
|
| 9 |
Daniel-Constantin Mierla |
| 10 |
|
| 11 |
<[email protected]> |
| 12 |
|
| 13 |
Copyright © 2014 asipto.com |
| 14 |
__________________________________________________________________ |
| 15 |
|
| 16 |
Table of Contents |
| 17 |
|
| 18 |
1. Admin Guide |
| 19 |
|
| 20 |
1. Overview |
| 21 |
2. Limitations |
| 22 |
3. Remarks |
| 23 |
4. Dependencies |
| 24 |
|
| 25 |
4.1. Kamailio Modules |
| 26 |
4.2. External Libraries or Applications |
| 27 |
|
| 28 |
5. Usage |
| 29 |
|
| 30 |
List of Examples |
| 31 |
|
| 32 |
1.1. Usage |
| 33 |
|
| 34 |
Chapter 1. Admin Guide |
| 35 |
|
| 36 |
Table of Contents |
| 37 |
|
| 38 |
1. Overview |
| 39 |
2. Limitations |
| 40 |
3. Remarks |
| 41 |
4. Dependencies |
| 42 |
|
| 43 |
4.1. Kamailio Modules |
| 44 |
4.2. External Libraries or Applications |
| 45 |
|
| 46 |
5. Usage |
| 47 |
|
| 48 |
1. Overview |
| 49 |
|
| 50 |
This module provides DB APIv1 connector for MongoDB NoSQL server. |
| 51 |
|
| 52 |
It can be used as a replacement for other database modules such as |
| 53 |
db_mysql, db_postgres, a.s.o. Not all the specs of DB APIv1 are |
| 54 |
implemented, thus the usage of this module might be restricted to |
| 55 |
specific modules. |
| 56 |
|
| 57 |
You can read more about MongoDB at: http://www.mongodb.org. |
| 58 |
|
| 59 |
2. Limitations |
| 60 |
|
| 61 |
This module has implemented the equivalent operations for INSERT, |
| 62 |
UPDATE, DELETE and SELECT. The match condition (WHERE clause) works |
| 63 |
with the operators: equal, not equal, greater than, less than, equal or |
| 64 |
greater than, equal or less than. Raw query is not implemented inside |
| 65 |
this module, use ndb_mongodb for sending any kind of command to a |
| 66 |
MongoDB server. |
| 67 |
|
| 68 |
3. Remarks |
| 69 |
|
| 70 |
Using this module as a database driver may require additional settings |
| 71 |
for various modules. For example, you have to set module parameter |
| 72 |
'db_insert_null' to 1 for 'usrloc' module. If the module you are using |
| 73 |
with 'db_mongodb' fails, check its README for notes about using it with |
| 74 |
no-SQL databases. |
| 75 |
|
| 76 |
4. Dependencies |
| 77 |
|
| 78 |
4.1. Kamailio Modules |
| 79 |
4.2. External Libraries or Applications |
| 80 |
|
| 81 |
4.1. Kamailio Modules |
| 82 |
|
| 83 |
The following modules must be loaded before this module: |
| 84 |
* none. |
| 85 |
|
| 86 |
4.2. External Libraries or Applications |
| 87 |
|
| 88 |
The following libraries or applications must be installed before |
| 89 |
running Kamailio with this module loaded: |
| 90 |
* mongo-c-driver - available at |
| 91 |
https://github.com/mongodb/mongo-c-driver |
| 92 |
Note: if you use tls module, use at least mongo-c-driver v1.3.5 and |
| 93 |
compile the library by configuring it without automatic init and |
| 94 |
cleanup (you have to run: './configure |
| 95 |
--disable-automatic-init-and-cleanup') -- this option is planned to |
| 96 |
be removed in future versions. An alternative for v1.3.5 could be |
| 97 |
the patch from: |
| 98 |
https://github.com/miconda/mongo-c-driver/commit/51d95009de39eaeca4 |
| 99 |
8491682a5ffec4f83cde55 |
| 100 |
|
| 101 |
5. Usage |
| 102 |
|
| 103 |
Load the module and set the DB URL for specific modules to: |
| 104 |
mongodb://username:password@host:port/database. Username, password and |
| 105 |
port are optional. |
| 106 |
|
| 107 |
Example 1.1. Usage |
| 108 |
... |
| 109 |
loadmodule "db_mongodb.so" |
| 110 |
... |
| 111 |
#!define DBURL "mongodb://localhost/kamailio" |
| 112 |
modparam("acc", "db_url", DBURL) |
| 113 |
... |