The port and/or hostname can be specified in multiple ways: Step 2: Specifying Host And/Or Port Of The MongoDB Instance mongoexport -collection=webinars -db=conduct -out=webinars.jsonĪ) Specifying the collection that you want to export, can be done in two ways: -collection= or -c=ī) Specifying the output file that you want to export to, can similarly be done in two ways: -out= or -o=Ĭ) Specifying the database you will be exporting from is represented as : -db= or -d=Įxample mongoexport command: mongoexport -db db1 -c collection1 -out dataexport.json Step 2: Specifying Host And/Or Port Of The MongoDB InstanceĪ MongoDB instance running on port “27017”, doesn’t necessarily require a host or port to be specified.Įxample query: Here conduct is the database from which webinars collection is being exported.Step 1: Connecting To A MongoDB Instance.Mongoexport helps to export data in the desired format of your choice in two steps: The collection that has to be exported needs to be specified by the user along with an output file name. The mongoexport command runs directly on the system command line & it can be used in the following way: mongoexport -collection= Method 1: Exporting Data Using mongoexport The data is returned as a JSON file in all scenarios. The following steps will outline some of the common syntax options your command may take. You must enter the mongoexport command directly into the MongoDB command line to export your collection.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |