[sr-dev] git:5.2:353192ca: db_mongodb: catch the null values and set the type to DB1_STRING

Daniel-Constantin Mierla miconda at gmail.com
Fri May 17 09:23:24 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 353192ca4f2203fb85fdda6e0ea9e734f27019cf
URL: https://github.com/kamailio/kamailio/commit/353192ca4f2203fb85fdda6e0ea9e734f27019cf

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-05-17T09:22:17+02:00

db_mongodb: catch the null values and set the type to DB1_STRING

- avoid the log message on unhandled type

(cherry picked from commit a5781fc4bb3063c6e7abf54d93178ef610617298)

---

Modified: src/modules/db_mongodb/mongodb_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/353192ca4f2203fb85fdda6e0ea9e734f27019cf.diff
Patch: https://github.com/kamailio/kamailio/commit/353192ca4f2203fb85fdda6e0ea9e734f27019cf.patch

---

diff --git a/src/modules/db_mongodb/mongodb_dbase.c b/src/modules/db_mongodb/mongodb_dbase.c
index 8d88049919..db7f67c1e9 100644
--- a/src/modules/db_mongodb/mongodb_dbase.c
+++ b/src/modules/db_mongodb/mongodb_dbase.c
@@ -504,13 +504,18 @@ int db_mongodb_get_columns(const db1_con_t* _h, db1_res_t* _r)
 				RES_TYPES(_r)[col] = DB1_STRING;
 				break;
 
+			case BSON_TYPE_NULL:
+				/* 'null' value - default to type DB1_STRING */
+				LM_DBG("BSON_TYPE_NULL - use DB1_STRING result type\n");
+				RES_TYPES(_r)[col] = DB1_STRING;
+				break;
+
 #if 0
 			case BSON_TYPE_EOD:
 			case BSON_TYPE_DOCUMENT:
 			case BSON_TYPE_ARRAY:
 			case BSON_TYPE_UNDEFINED:
 			case BSON_TYPE_OID:
-			case BSON_TYPE_NULL:
 			case BSON_TYPE_REGEX:
 			case BSON_TYPE_DBPOINTER:
 			case BSON_TYPE_CODE:




More information about the sr-dev mailing list