Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d87d5d2
mongo connector
undertaker86001 Aug 12, 2025
9aca2cb
add docs
undertaker86001 Aug 12, 2025
2f345d5
add mongodb frontend && update background
undertaker86001 Aug 15, 2025
645931a
add test && doc
undertaker86001 Aug 15, 2025
d121461
add en doc
undertaker86001 Aug 15, 2025
7d6dc99
remove useless doc
undertaker86001 Aug 15, 2025
4ce84f4
add mutli mode
undertaker86001 Aug 15, 2025
fb634d8
update doc
undertaker86001 Aug 15, 2025
f5e66b4
fix: correct syntax error in MongoDB plugin tests
devin-ai-integration[bot] Aug 19, 2025
cc6547f
fix connection leak
Aug 19, 2025
f407c4c
remove time.sleep
Aug 19, 2025
f793bf9
refactor: support dynamic lastsynctime
Aug 19, 2025
45716f8
refactor:adapter sync_strategy
Aug 19, 2025
f28b36f
refactor: pre-allocate slice
Aug 19, 2025
dec2283
add system field
undertaker86001 Aug 21, 2025
c0ac8aa
refactor: use task framework
undertaker86001 Aug 21, 2025
5e75ebe
Merge branch 'issue-456' of https://github.com/undertaker86001/coco-s…
undertaker86001 Aug 22, 2025
4d817e8
remove useless files
undertaker86001 Aug 22, 2025
fe69e19
remove useless files
undertaker86001 Aug 22, 2025
bb3351a
update doc
undertaker86001 Aug 22, 2025
df53181
remove useless doc
undertaker86001 Aug 22, 2025
23f0111
refactor: simpfy monitor
undertaker86001 Aug 22, 2025
7114911
extract common config
undertaker86001 Aug 25, 2025
7f1e583
Merge remote-tracking branch 'upstream/main' into issue-456
undertaker86001 Aug 25, 2025
dc5ae54
merge conf
undertaker86001 Aug 25, 2025
9aa28fb
fix test && remove useless code
Aug 25, 2025
ae52455
fix imports
Aug 25, 2025
eeeb02e
add field mapping
Aug 26, 2025
ebb21ef
update imports
Aug 26, 2025
8b7ff74
Merge remote-tracking branch 'upstream/main' into issue-456
Aug 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions coco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ connector:
interval: 10s
queue:
name: indexing_documents
mongodb:
enabled: true
interval: 30s
queue:
name: indexing_documents
notion:
enabled: true
interval: 10s
Expand Down
99 changes: 98 additions & 1 deletion config/setup/en-US/connector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,101 @@ POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/n
}
},
"builtin": true
}
}
POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/postgresql
{
"id" : "postgresql",
"created" : "2025-08-14T00:00:00.000000+08:00",
"updated" : "2025-08-14T00:00:00.000000+08:00",
"name" : "PostgreSQL Connector",
"description" : "Fetch data from PostgreSQL database.",
"category" : "database",
"icon" : "/assets/icons/connector/postgresql/icon.png",
"tags" : [
"sql",
"storage",
"database"
],
"url" : "http://coco.rs/connectors/postgresql",
"assets" : {
"icons" : {
"default" : "/assets/icons/connector/postgresql/icon.png"
}
},
"builtin": true
}
POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/mongodb
{
"id" : "mongodb",
"created" : "2025-01-12T00:00:00.000000+08:00",
"updated" : "2025-01-12T00:00:00.000000+08:00",
"name" : "MongoDB Connector",
"description" : "Powerful MongoDB database connector supporting incremental/full sync, field mapping (collection-level + global-level), pagination, cluster type optimization, authentication database configuration, projection pushdown, index hints, and other advanced features. Supports standalone, replica set, and sharded cluster deployments.",
"category" : "database",
"icon" : "/assets/icons/connector/mongodb/icon.png",
"tags" : [
"nosql",
"storage",
"database",
"document",
"mongodb",
"incremental_sync",
"field_mapping",
"pagination",
"cluster_optimization",
"authentication",
"performance"
],
"url" : "http://coco.rs/connectors/mongodb",
"assets" : {
"icons" : {
"default" : "/assets/icons/connector/mongodb/icon.png",
"collection" : "/assets/icons/connector/mongodb/collection.png",
"document" : "/assets/icons/connector/mongodb/document.png",
"replica_set" : "/assets/icons/connector/mongodb/replica_set.png",
"sharded" : "/assets/icons/connector/mongodb/sharded.png"
}
},
"config": {
"connection_uri": "mongodb://username:password@localhost:27017/database",
"database": "database_name",
"auth_database": "admin",
"cluster_type": "standalone",
"collections": [
{
"name": "collection_name",
"filter": {"status": "active"},
"title_field": "title",
"content_field": "content",
"category_field": "category",
"tags_field": "tags",
"url_field": "url",
"timestamp_field": "updated_at"
}
],
"pagination": true,
"page_size": 500,
"sync_strategy": "incremental",
"last_modified_field": "updated_at",
"field_mapping": {
"enabled": true,
"mapping": {
"id": "custom_id",
"title": "custom_title",
"content": "custom_content",
"category": "custom_category",
"tags": "custom_tags",
"url": "custom_url",
"metadata": "extra_fields"
}
},
"performance": {
"batch_size": 1000,
"max_pool_size": 10,
"timeout": "30s",
"enable_projection": true,
"enable_index_hint": true
}
},
"builtin": true
}
99 changes: 98 additions & 1 deletion config/setup/zh-CN/connector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,101 @@ POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/n
}
},
"builtin": true
}
}
POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/postgresql
{
"id" : "postgresql",
"created" : "2025-08-14T00:00:00.000000+08:00",
"updated" : "2025-08-14T00:00:00.000000+08:00",
"name" : "PostgreSQL 连接器",
"description" : "提取 PostgreSQL 数据库数据。",
"category" : "database",
"icon" : "/assets/icons/connector/postgresql/icon.png",
"tags" : [
"sql",
"storage",
"database"
],
"url" : "http://coco.rs/connectors/postgresql",
"assets" : {
"icons" : {
"default" : "/assets/icons/connector/postgresql/icon.png"
}
},
"builtin": true
}
POST $[[SETUP_INDEX_PREFIX]]connector$[[SETUP_SCHEMA_VER]]/$[[SETUP_DOC_TYPE]]/mongodb
{
"id" : "mongodb",
"created" : "2025-01-12T00:00:00.000000+08:00",
"updated" : "2025-01-12T00:00:00.000000+08:00",
"name" : "MongoDB 连接器",
"description" : "强大的MongoDB数据库连接器,支持增量/全量同步、字段映射(集合级别+全局级别)、分页处理、集群类型优化、认证数据库配置、投影下推、索引提示等高级功能。支持单机、复制集、分片集群部署。",
"category" : "database",
"icon" : "/assets/icons/connector/mongodb/icon.png",
"tags" : [
"nosql",
"storage",
"database",
"document",
"mongodb",
"incremental_sync",
"field_mapping",
"pagination",
"cluster_optimization",
"authentication",
"performance"
],
"url" : "http://coco.rs/connectors/mongodb",
"assets" : {
"icons" : {
"default" : "/assets/icons/connector/mongodb/icon.png",
"collection" : "/assets/icons/connector/mongodb/collection.png",
"document" : "/assets/icons/connector/mongodb/document.png",
"replica_set" : "/assets/icons/connector/mongodb/replica_set.png",
"sharded" : "/assets/icons/connector/mongodb/sharded.png"
}
},
"config": {
"connection_uri": "mongodb://username:password@localhost:27017/database",
"database": "database_name",
"auth_database": "admin",
"cluster_type": "standalone",
"collections": [
{
"name": "collection_name",
"filter": {"status": "active"},
"title_field": "title",
"content_field": "content",
"category_field": "category",
"tags_field": "tags",
"url_field": "url",
"timestamp_field": "updated_at"
}
],
"pagination": true,
"page_size": 500,
"sync_strategy": "incremental",
"last_modified_field": "updated_at",
"field_mapping": {
"enabled": true,
"mapping": {
"id": "custom_id",
"title": "custom_title",
"content": "custom_content",
"category": "custom_category",
"tags": "custom_tags",
"url": "custom_url",
"metadata": "extra_fields"
}
},
"performance": {
"batch_size": 1000,
"max_pool_size": 10,
"timeout": "30s",
"enable_projection": true,
"enable_index_hint": true
}
},
"builtin": true
}
41 changes: 41 additions & 0 deletions docker/init-mongo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// MongoDB initialization script for testing
db = db.getSiblingDB('coco_test');

// Create test user
db.createUser({
user: 'coco_test',
pwd: 'test_password',
roles: [
{
role: 'readWrite',
db: 'coco_test'
}
]
});

// Create test collections with sample data
db.articles.insertMany([
{
title: "Sample Article 1",
content: "This is sample content for testing",
category: "Technology",
tags: ["mongodb", "database"],
url: "https://example.com/article1",
updated_at: new Date(),
status: "published"
},
{
title: "Sample Article 2",
content: "Another sample content for testing",
category: "Programming",
tags: ["go", "backend"],
url: "https://example.com/article2",
updated_at: new Date(),
status: "draft"
}
]);

// Create indexes for better performance
db.articles.createIndex({ "updated_at": 1 });
db.articles.createIndex({ "status": 1 });
db.articles.createIndex({ "category": 1 });
36 changes: 36 additions & 0 deletions docker/mongodb-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: '3.8'

services:
mongodb:
image: mongo:7.0
container_name: coco-mongodb-test
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: coco_test
volumes:
- mongodb_data:/data/db
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
networks:
- coco-test

mongodb-replica:
image: mongo:7.0
container_name: coco-mongodb-replica-test
ports:
- "27018:27017"
command: mongod --replSet rs0 --bind_ip_all
volumes:
- mongodb_replica_data:/data/db
networks:
- coco-test

volumes:
mongodb_data:
mongodb_replica_data:

networks:
coco-test:
driver: bridge
22 changes: 22 additions & 0 deletions examples/mongodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MongoDB Connector Default Configuration
mongodb:
# Default connection settings
default_timeout: "30s"
default_batch_size: 1000
default_max_pool_size: 10

# Default sync settings
default_sync_strategy: "full"

# Performance tuning
max_concurrent_collections: 5
memory_gc_interval: 10000

# Retry settings
connection_retry_attempts: 3
connection_retry_delay: "30s"

# Logging
log_level: "info"
log_slow_queries: true
slow_query_threshold: "5s"
Loading