mongoimport is not showing the collection after import has run successfully

1,795 views
Skip to first unread message

Ritesh Arora

unread,
Apr 16, 2012, 11:42:31 AM4/16/12
to mongodb-user
Hi All,

I am using following command to import a large, approx. 50Gb, file in
mongo. I am using the following command:

./mongoimport --host localhost --db --collection part1 --type tsv --
file part1_Final.tsv --headerline --upsert

After hours, it says successfully imported the rows, but when I go and
check in my db it doesn't show up. However, when I use the same
command with a file of much smaller size it works fine.

Kindly let me know if someone faced the similar issue and got it to
work.

~Sunny

Scott Hernandez

unread,
Apr 16, 2012, 12:14:43 PM4/16/12
to mongod...@googlegroups.com
You seems to be missing the option after --db for the database you
importing into. When I run without the correct args like that I get an
error.

Can you post the output from the import command? What does it actually
say it did?

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

Ritesh Arora

unread,
Apr 16, 2012, 5:49:32 PM4/16/12
to mongodb-user
Hi,

Thanks for pointing it out

Originally I am giving the database name as:

./mongoimport --host localhost --db <dbname here> --collection
<collection name here> --type tsv --file remaining_Final.tsv --
headerline --upsert

I am getting that

imported 284263255 objects and it matches with the number of rows in
my tsv file, but still it doesn't show up in my db when I do
db.getCollectionNames()

ANy help is highly appreciated.

Regards,
Ritesh

Eliot Horowitz

unread,
Apr 17, 2012, 1:35:54 AM4/17/12
to mongod...@googlegroups.com
Are you switching to the right db?
Anything in the server log?
CAn you run the server in verbose mode?

Ritesh Arora

unread,
Apr 19, 2012, 4:09:07 AM4/19/12
to mongod...@googlegroups.com
I searched the logs and found that there were $ symbols in some fields, so there were erros, but now I am even more confused. If errors were there then why did it say that imported so many records successfully. However, I was in the correct db and collection name was also correct. 

Thanks,
Ritesh Arora

>> > To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.


>> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.

> To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.

zack_syah

unread,
Jun 14, 2012, 5:26:22 PM6/14/12
to mongod...@googlegroups.com
I tried mongo imort like this "mongoimport --host localhost --db local --collection lecturer --type json --file temp.json --headerline --upsert" and I've got same error message "Syntax Error: missing ; before statement (shell):1"
what's wrong with my code & how to import if my data stored in C:\Documents and Settings\User\Desktop ?? please help, thank's in advance 

Stephen Steneker

unread,
Jun 20, 2012, 8:06:30 AM6/20/12
to mongod...@googlegroups.com
On Friday, June 15, 2012 7:26:22 AM UTC+10, zack_syah wrote:
I tried mongo imort like this "mongoimport --host localhost --db local --collection lecturer --type json --file temp.json --headerline --upsert" and I've got same error message "Syntax Error: missing ; before statement (shell):1"
what's wrong with my code & how to import if my data stored in C:\Documents and Settings\User\Desktop ?? please help, thank's in advance 

Hi Zack,

Based on the error message it seems like you're trying to run "mongoimport" in the JS shell .. it actually needs to be run directly from a command line.

Also, in future please send a new message rather than replying to an old (unrelated) thread.

Cheers,
Stephen
Reply all
Reply to author
Forward
0 new messages