File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -1154,18 +1154,13 @@ void RedisMongoDB::add_pattern_index_schema(const string& tokens,
11541154 index_entries_array.append (index_entry_array);
11551155 }
11561156
1157- auto conn = this ->mongodb_pool ->acquire ();
1158- auto mongodb_collection = (*conn)[MONGODB_DB_NAME][MONGODB_PATTERN_INDEX_SCHEMA_COLLECTION_NAME];
1159-
1160- auto reply = mongodb_collection.insert_one (bsoncxx::v_noabi::builder::basic::make_document (
1157+ auto document = bsoncxx::v_noabi::builder::basic::make_document (
11611158 bsoncxx::v_noabi::builder::basic::kvp (MONGODB_FIELD_NAME[MONGODB_FIELD::ID], id),
11621159 bsoncxx::v_noabi::builder::basic::kvp (" tokens" , tokens),
11631160 bsoncxx::v_noabi::builder::basic::kvp (" priority" , this ->pattern_index_schema_next_priority ),
1164- bsoncxx::v_noabi::builder::basic::kvp (" index_entries" , index_entries_array))) ;
1161+ bsoncxx::v_noabi::builder::basic::kvp (" index_entries" , index_entries_array));
11651162
1166- if (!reply) {
1167- Utils::error (" Failed to insert pattern index schema into MongoDB" );
1168- }
1163+ this ->upsert_document (document, MONGODB_PATTERN_INDEX_SCHEMA_COLLECTION_NAME);
11691164
11701165 this ->pattern_index_schema_map [this ->pattern_index_schema_next_priority ] =
11711166 make_tuple (move (tokens_vector), index_entries);
You can’t perform that action at this time.
0 commit comments