Copying collection from local database to remote server

228 views
Skip to first unread message

Yaroslav Kyrpych

unread,
Feb 21, 2015, 6:09:13 PM2/21/15
to mongod...@googlegroups.com
Hi,

I was hoping to use mongodump to copy collection from local database to remote server. However, I read on mongodb web-site that "mongodump does not dump the content of the local database." http://docs.mongodb.org/manual/reference/program/mongodump/

Is there a way to copy collection from local database to remote? If so, could someone share example?

I wanted to use replication but  it seems to have the same issue - it's made to work from remote to local, not the other way. Plus, I don't have local always online.

Thank you,

Yaroslav

Asya Kamsky

unread,
Feb 22, 2015, 1:47:11 AM2/22/15
to mongodb-user
If you specify 

mongodump -d local -c <collection-name> 

then mongodump will dump the specified collection from the local DB.

What collection from local do you want to copy?   Generally the point of "local" db is to use it only for things that are local to this instance.

Asya


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABSeBiy1aRNtUbMkAiVhzADJ%2Bojd0_LS6xzHFSdS3pQJkNuMSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
{ "name" : "Asya Kamsky",
  "place" : [ "New York", "Palo Alto", "Everywhere else" ],
  "email" : "as...@mongodb.com",
  "blog" : "http://www.askasya.com/",
  "twitter": "@asya999" }

Yaroslav Kyrpych

unread,
Mar 4, 2015, 1:18:23 PM3/4/15
to mongod...@googlegroups.com
I have collection called "returns" within database called "financial data" (database has other collections but I don't need to more them), it's all stored on local PC, I would like to move the collection (not entire database) to the database also called "financial data" that's located on remote server (VPS hosting). Could you let me know if it's possible at all, and if so, how to do it.
 
Thank you,
 
Yaroslav

Asya Kamsky

unread,
Mar 7, 2015, 4:48:00 PM3/7/15
to mongodb-user
Ah, when you said local I thought you meant "local" db name.

You can ignore the comment you read in the docs - when it says
"mongodump does not dump 'local' database" it means the database
called 'local' - your database is called something else, so just
specify the name of the DB and collection you want and mongodump will
dump it.

Asya


On Wed, Mar 4, 2015 at 1:17 PM, Yaroslav Kyrpych
> https://groups.google.com/d/msgid/mongodb-user/CABSeBiz35G8PrZVe51oQ46UrzSXBz%2BSv22csfhXHjpMNa2HF9Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages