At present, a method has been found, but the method has the problem that the document is too long to be effectively processed.
DB. Area. INSERT ('NUMBER':' 01010',' PROVISION':' Inner Mongolia Autonomous Region',' city':' Hohhot',' disc':' New Town',' addr':' Guanghua Street (No.14 Middle School Family Building)',' jd':' New Town District of Hohhot City, Inner Mongolia Autonomous Region'})
DB. Area. INSERT (('NUMBER':' 01010',' PROVISION':' Inner Mongolia Autonomous Region',' city':' Hohhot',' disc':' New Town',' addr':' Xing 'an South Road',' jd':' New Town of Hohhot City, Inner Mongolia Autonomous Region'})
cat mon | /usr/local/mongodb/bin/mongo localhost/zip --shell
When the insert document is too long, this method will report an error, displaying unexpected token ILLEGAL and unexpected identifier. But there is no problem executing the same command in Robomongo.
Mongoimport cannot be used because the batch processing is a mixed insert and update command and involves multiple sets.
The operating environment is linux
Directly write all the code to be executed into one
all.js
File, then usemongo localhost/zip all.js
Execute.