Showing posts with label mongodb. Show all posts
Showing posts with label mongodb. Show all posts
Saturday, May 16, 2020
Wednesday, May 6, 2020
Thursday, April 30, 2020
Thursday, October 24, 2019
Uninstall Mongo old version and Install new version
1) backup data
mkdir mongodb-dump-oct24-2019
cd mongodb-dump-oct24-2019
mongodump
Above will create a folder called 'dump' within 'mongodb-dump-oct24-2019' folder.
2) Uninstall existing version of mongodb
https://medium.com/@rajanmaharjan/uninstall-mongodb-macos-completely-d2a6d6c163f9
3) Install new version
https://stackoverflow.com/questions/57856809/installing-mongodb-with-homebrew
cd mongodb-dump-oct24-2019
mongorestore
mkdir mongodb-dump-oct24-2019
cd mongodb-dump-oct24-2019
mongodump
Above will create a folder called 'dump' within 'mongodb-dump-oct24-2019' folder.
2) Uninstall existing version of mongodb
https://medium.com/@rajanmaharjan/uninstall-mongodb-macos-completely-d2a6d6c163f9
3) Install new version
https://stackoverflow.com/questions/57856809/installing-mongodb-with-homebrew
brew tap mongodb/brew
brew install mongodb-community@4.0
4) brew link --force mongodb-community@4.0brew services start mongodb-community@4.05) Restore data
cd mongodb-dump-oct24-2019
mongorestore
Monday, October 21, 2019
Monday, September 16, 2019
Rails & Mongo - connecting to Mongodb from rails console
client= Mongo::Client.new('mongodb://username:password@serverIP:27017/databaseName?authSource=authSource db')
db = client.database
db.collections
Sunday, January 27, 2019
MongoDB with Elixir
https://medium.com/@petecorey/how-to-use-mongodb-with-elixir-ac3f814f8b4a
https://whitfin.io/using-mongodb-with-elixir-phoenix-and-ecto/
Connecting to MongoDB directly from Elixir - https://github.com/ankhers/mongodb
Tuesday, October 2, 2018
Mongo - exporting and importing a single database
On Source Machine
-------------------------
mongo
> show dbs
> exit
mongodump -d abc_xyz_development
(Above command will create a dump/abc_xyz_development folder and put all the files inside it. This folder will need to be zipped and sent to whoever wants to import the database)
On Target Machine
-------------------------
Drop existing database
mongo
> show dbs
> use abc_xyz_development;
> db.dropDatabase();
> exit
Restore from Dump folder:
Command:
mongorestore -d
E.g.
mongorestore -d abc_xyz_development ~/abc_xyz_development
-------------------------
mongo
> show dbs
> exit
mongodump -d abc_xyz_development
(Above command will create a dump/abc_xyz_development folder and put all the files inside it. This folder will need to be zipped and sent to whoever wants to import the database)
On Target Machine
-------------------------
Drop existing database
mongo
> show dbs
> use abc_xyz_development;
> db.dropDatabase();
> exit
Restore from Dump folder:
Command:
mongorestore -d
E.g.
mongorestore -d abc_xyz_development ~/abc_xyz_development
Wednesday, June 13, 2018
Monday, April 16, 2018
Mongodb related
1) Export
mongodump
Above command will export everything (all databases) into a folder called 'dump'
2) Import
mongorestore dump
mongodump
Above command will export everything (all databases) into a folder called 'dump'
2) Import
mongorestore dump
Tuesday, September 6, 2016
Monday, July 4, 2016
Mongodb - getting started
1) mongo
- to launch mongo shell
2) db.adminCommand( { listDatabases: 1 } )
- to list the databases
3) use abc
- assuming 'abc' is one of the databases listed by command 2
4) db.getCollectionNames()
- to list all the collections
- i think we have to run our queries on Collections just like we would run queries on Tables in a Sql database
5) db.users.findOne()
- assuming 'users' is a collection
- to launch mongo shell
2) db.adminCommand( { listDatabases: 1 } )
- to list the databases
3) use abc
- assuming 'abc' is one of the databases listed by command 2
4) db.getCollectionNames()
- to list all the collections
- i think we have to run our queries on Collections just like we would run queries on Tables in a Sql database
5) db.users.findOne()
- assuming 'users' is a collection
Subscribe to:
Posts (Atom)