Home > Database > Mysql Tutorial > datax转换mongodb的数据到mysql遇到一个问题

datax转换mongodb的数据到mysql遇到一个问题

WBOY
Release: 2016-06-06 09:33:17
Original
3792 people have browsed it

mysqlmongodb数据

公司新项目需要从旧的mongodb库了把数据导入到新的mysql库。在用淘宝的datax工具导入数据的时候遇到以下的问题
mongodb的是数据很多都是一个document里不是所有字段都的值都有.
例如:user = [{“name”:”张三”,”id”:”0000001″},
{“age”:12,”id”:”0000002″},
{“name”:”王二麻子”,”age”:13,”id”:”0000003″}]

这样在datax调度Job的时候回报读入和写入的字段数量不同。

请问该如何解决?
我的job.json配置如下:
{
"job": {
"setting": {
"speed": {
"channel": 2
}
},
"content": [
{
"reader": {
"name": "mongodbreader",
"parameter": {
"address": ["192.168.1.1:27017"],
"userName": "",
"userPassword": "",
"dbName": "test",
"collectionName": "usertest"
"column": [
{
"name": "name",
"type": "string"
},

{
"name": "age",
"type": "int"
},
{
"name": "id",
"type": "string"
}
]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "user",
"password": "123456",
"column": [
"id",
"name",
"age"
],
"session": [
"set session sql_mode='ANSI'"
],
"preSql": [
"delete from user"
],
"connection": [
{
"jdbcUrl": "jdbc:mysql://192.168.1.1:3306/datax?useUnicode=true&characterEncoding=utf-8",
"table": [
"user"
]
}
]
}
}
}
]
}
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template