Awesome, thanks Lachie for your help, I managed to restore the dump files into the ce database. I've also moved the ce directory out of data/db. I also managed to export a collection to a json file, using mongoexport. I didn't specify a path for the output file, and can't seem to find it!! oops! Any idea where the default location is for exported json files? In the help it said that if you do not specify a path "it uses stdout"?
Many thanks. Iz On Wed, Aug 24, 2011 at 3:24 PM, Lachie <[email protected]> wrote: > On Wed, Aug 24, 2011 at 12:17 PM, Iz103 <[email protected]> wrote: > > Hey fellow Rubyists, how's it going! > > > > I am after some Mongo help! I've basically been given a BSON dump of > > a number of Mongo collections (taken from a .Net app). I have saved > > them in /data/db as per the MongoDB docs. The BSON files are > > contained in a folder called "ce" (i.e. the name of the db). So > > basically the route to the files is /data/db/ce. In the Mongo shell I > > need to "tell" mongo where to look for these collections, which I > > can't seem to be able to do. I did "show dbs", which showed current > > dbs, and "ce" did not exist. I also did "use ce", but now I have a ce > > database that is empty. > > Hi... > the bson files you have are just dumps, they're not actual live databases. > > You need to load them into a running instance of mongo, using mongorestore > > something like > > $ mongorestore -d ce /data/db/ce > > This will create the ce database in mongo (if it doesn't exist) and > insert the bson documents from /data/db/ce. > > By the way, if /data/db is where you've got mongo set up to store its > data, I'd move your ce directory out of there first :) > > hth > Lachie > > > The main aim really is to connect to these BSON files, export a > > collection to json file, parse that file and change the conventions to > > make them more Rails like, and loop over them to create records in a > > new db. The new db is part of a Rails app, using Mongoid. > > > > I've been searching around the web and can't seem to find much. I > > would appreciate any suggestions or references to any resources out > > there. Also, if there is a better way to achieve the above (i.e build > > modified collections in a new db from an existing db), that would be > > great! > > > > Many thanks in advance. > > > > Best regards, > > > > Iz > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]. > > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
