[英]MongoDB: mongoimport isodate on Ubuntu 14.04LTS
Platform: Ubuntu 14.04 LTS 64bit Python installed, can't remember its version right now: I can update this question later 平台:已安装Ubuntu 14.04 LTS 64位Python,现在不记得其版本:我稍后可以更新此问题
....$>sudo mongod --versiondb
version v2.4.9 git
git version: nogitversion
....$>sudo service mongodb status
start
My dbpath variable set on /etc/mongod.config is equals to /home/utente/OFS/datasource . 我在/etc/mongod.config上设置的dbpath变量等于/ home / utente / OFS / datasource 。 I gave right permissions with chmod.
我给了chmod正确的权限。 From mongodb.log file I can see last line like:" ...waiting for connection on port 27017 " Open a terminal, trying to import the json here below:
从mongodb.log文件中,我可以看到最后一行,例如:“ ...正在等待端口27017上的连接 ”打开终端,尝试在此处导入json:
{ "_id":ObjectId("572f36bcb69df6b4280cee68"), "formatoPreferito":ObjectId("57121b0d1dab7d841d149ed0"), "nome":"fra", "cognome":"back", "dataNascita":ISODate("1987-09-17T22:00:00Z"), "email":"test@test.com", "password":"$2a$10$4LR/kFI.FHPXHug7Jo9z0.mSgFqT4j4ZMeM.x1MdBfp5HGAFCvdOG", "ereader":"kindle", "token":"$2a$10$WBT5.ylZiRkfSZM./7XUtemllTNN5jaJJy8KsVISvJTvUyUmP49ki", "dataRegistrazione":ISODate("2016-05-08T12:53:15.262Z"), "attivo":true }
{“ _id”:ObjectId(“ 572f36bcb69df6b4280cee68”),“ formatoPreferito”:ObjectId(“ 57121b0d1dab7d841d149ed0”),“ nome”:“ fra”,“ cognome”:“ back”,“ dataNascita”:ISODate(“ 1987-09- 17T22:00:00Z“),” email“:” test@test.com“,” password“:” $ 2a $ 10 $ 4LR / kFI.FHPXHug7Jo9z0.mSgFqT4j4ZMeM.x1MdBfp5HGAFCvdOG“,” ereader“:” kindle“,” token “:”“ $ 2a $ 10 $ WBT5.ylZiRkfSZM。/ 7XUtemllTNN5jaJJy8KsVISvJTvUyUmP49ki”,“ dataRegistrazione”:ISODate(“ 2016-05-08T12:53:15.262Z”),“ attivo”:true}
With the command: 使用命令:
mongoimport --db ofs --collection utenti --host localhost --port 27017 --drop --file /home/utente/OFS/load.utenti.json
With the output: 随着输出:
connected to: localhost:27017 Tue May 24 00:04:27.151 dropping: ofs.utenti Tue May 24 00:04:27.152 exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:149 Tue May 24 00:04:27.152
已连接到:localhost:27017 5月24日星期二00:04:27.151删除:ofs.utenti 5月24日星期二00:04:27.152异常:提供的JSON的BSON表示太大:代码FailedToParse:FailedToParse: 值中的错误字符:偏移量: 149周二5月24日00:04:27.152
Tue May 24 00:04:27.152 exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:149 Tue May 24 00:04:27.152 imported 0 objects Tue May 24 00:04:27.152 ERROR: encountered 2 error(s)s utente@utente-X551CAP:~/OFS$Tue May 24 00:04:27.152 Tue May 24 00:04:27.152 check 0 05月24日星期二00:04:27.152异常:提供的JSON的BSON表示太大:代码FailedToParse:FailedToParse:值中的错误字符:offset:149 2月5日24 00:04:27.152导入了0个对象2月24日00:04: 27.152错误:遇到2个错误utente @ utente-X551CAP:〜/ OFS $ Tue May 24 00:04:27.152 Tue May 24 00:04:27.152 check 0 0
offset 149, watched on text editor, is the position of the ':' character on the dataNascita field. 在文本编辑器上观察到的偏移量149是dataNascita字段上':'字符的位置 。 The --jsonArray parameter does not fix the errors.
--jsonArray参数不能修复错误。 Question: is It something wrong with the json file or is It something wrong with ISODate data type and my version of mongodb?
问题:json文件有问题还是ISODate数据类型和我的mongodb版本有问题? (it is not the mongodb-org software installed).
(它不是安装的mongodb-org软件)。
with a later mongodb version it seems all to work just fine: 在更高版本的mongodb中,似乎一切正常:
So now I am going back home, remove mongodb installed, install later version and update here. 所以现在我要回家,删除已安装的mongodb,安装更高版本并在此处更新。
It turns the installation was not successfully ended. 轮到安装未成功结束。 I installed the same mongodb version one time again.
我再次安装了相同的mongodb版本。 As soon as the installation ended, I was able to run successfully the mongoimport command with the ISODate objects inside the json input file.
安装结束后,我就能够在json输入文件中的ISODate对象上成功运行mongoimport命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.