rom
rom

Reputation: 664

How do you convert mongod to mongo service?

I have been running MongoDB on two Windows 10 PCs. However, one has mongo always running it seems where I only need to open command prompt and type mongo. This gives me access to the db on PC #1.

However, on PC #2, I must open command prompt and type mongod. Then I have to open a second command prompt to type in mongo, then I get access to the db on PC #2.

After doing this for about a year, I find I want to just want both PCs to work like PC #1, where I just type in mongo and not mongodb and only have to use one command prompt.

I checked online but there's nothing I found straightforward to accomplish this specifically.

Does anybody know the answer?

Upvotes: 0

Views: 67

Answers (1)

RLD
RLD

Reputation: 2005

If in PC#2, your MongoDB version is < 4.0, then you can't do anything i.e., you have to continue with mongod to start Mongo as you do now. But if your MongoDB version is >= 4.0 or you want to upgrade from lower version of MongoDB, you can follow the below steps.

  1. Take backup of all databases with mongodump. If it is large volume data, then go through this.
  2. Uninstall your MongoDB using Windows Uninstall Program features.
  3. Reinstall MongoDB using the link.
  4. While installing, ensure you select 'MongoDB Service' feature.
  5. Start the MongoDB now in PC#2 as you do in PC#1.
  6. Restore the old databases with mongorestore.

Upvotes: 1

Related Questions