我正在尝试使用 mongoimport 从 CSV 导入到 mongodb 3.4,并且我希望将空列作为字段的空值导入。
mongoimport 文档给我的印象是,如果未指定 --ignoreBlanks,我将得到我想要的行为。
--忽略空白
Run Code Online (Sandbox Code Playgroud)Ignores empty fields in csv and tsv exports. If not specified, mongoimport creates fields without values in imported documents.
但是,当我尝试在不使用 --ignoreblanks 的情况下加载此示例数据时:
field_1.string(),field_2.int32(),field_3.string()
A,5,B
C,,D
E,7,F
Run Code Online (Sandbox Code Playgroud)
然后我在任何不是字符串的字段上收到错误。
mongoimport --collection null_test --type csv --headerline --columnsHaveTypes --file null_test.csv --verbose
2017-08-08T16:55:42.989+0000 filesize: 67 bytes
2017-08-08T16:55:42.989+0000 using fields: field_1,field_2,field_3
2017-08-08T16:55:43.001+0000 connected to: localhost:27017
2017-08-08T16:55:43.001+0000 ns: DEV.null_test
2017-08-08T16:55:43.001+0000 connected to node type: standalone
2017-08-08T16:55:43.001+0000 using write concern: w='1', j=false, fsync=false, wtimeout=0
2017-08-08T16:55:43.001+0000 using write …Run Code Online (Sandbox Code Playgroud) 我可以更改 Netezza 中的数据输入格式吗?例如,每当我导入 007 或 041 或 063 等数字时,输出分别为 7 ,41,63 ,这会破坏业务需求。
很抱歉问了这么愚蠢的问题,因为我是 Netezza 的新手。