I need to work with MongoDB Atlas but unsure how to set it up? I have never used Cloud DB before. I want to make sure that I can let everyone connect to it without an API Key
Sign up with MongoDB Atlas
Go to the MongoDB Atlas website and sign up: https://www.mongodb.com/cloud/atlas
Fill in the form to create your account:
Once you are in, it will ask you to select a path for clustering. Select the Free option at this time.
Then it will ask you to create a starter cluster
All default settings are fine
Encourage you to rename your cluster and then Click Create
After about a minute, it’s created
Click on Collections button
For first time use it will ask if you want sample data
If you just need sample data to play with, click on Load a Sample Dataset
For that, just follow the prompts
All your data will load
Next click on Database Access, we will need to create a database user
Keep it easy, use a password and select the role that this user should have
Click Add User
Now we need to white List IPs
Click on Network Access
Then click on Add IP, then "allow access from anyone" (No need for API Key)
You can always change this later but for testing purposes, you can select this
Click Confirm
Wait until it states that it’s active
Now click on Cluster and Connect
Select Connect using MongoDB Compass
Leave settings as is and copy the string and make the changes
For our purposes, here is our connection string.
mongodb+srv://Cam_user:Password1#camcluster.l41xe.mongodb.net/sample_airbnb
Related
I want to add two different database for my node app in mongodb atlas in same cluster i.e. one for production and one for development but mongodb atlas is not showing databasename or myfirstfile after #cluster0.irbg7.mongodb.net/ in the below url. How do i add different database in such situations?
I assume that you already created the cluster. In one cluster you can add multiple Databases.
On your home page, you are able to see something like this.
Click on the Browse Collections to browse the collections.
Now create Database as much as you like.
To connect to the desired database, use the connection string followed by database name.
Example: 'mongodb://<username>:<password>#<clustername>/<dbname>?ssl=true&replicaSet=<replica setname>&authSource=admin
I’ve got an iOS (swift) app that’s using a local realm. I’m trying to update it to use a synced realm so eventually I can make my app multi-user and share data. But I am new to MongoDB and Synced Realms.
I’ve successfully installed/build/run the “TaskTracker” starter “Synced” app on atlas and an iOS client.
Now I’m trying to make a Synced Realm for my app. I figure I would create a Synced Realm and put it in Development mode from scratch. That way I can convert my existing data into Synced data bit by bit and I don’t have to worry about the server side schema yet. I’m hoping that the schema will be defined for me and I can use it once I’m ready to move to a production level deployment.
So, I followed the “Get Started with Sync” document (https://docs.mongodb.com/realm/sync/get-started/). I’ve created my Atlas Cluster (Cluster0), and a Realm app in the web UI. The document says:
Navigate to the Realm Sync Panel
Decide whether to use Development Mode (I am).
Configure Sync:
In this step in the web UI, it seems that there are 3 steps:
Select a Cluster to Sync
Choose a Partition Key
Define a Database Name
For Step 1, I can select “Cluster0 - (Service: mongodb-atlas)”
However in Step 2 is where I get stuck: There is a dropdown that says “Enter a partition key field name…”, but when I select the drop down, it says “No options” and I cannot select anytthing. Therefore I can’t go to the third step or turn dev mode on.
The “Get Started with Sync” document doesn’t say anything about pre-populating the realm with data or schema (I thought that’s why I’m choosing Development Mode, so I can define my data on the fly until I figure out what the schema should be).
I even went back and created a database in the atlas cluster, but even after creating the database and a collection, the "Choose a Partition Key" dropdown still says "No actions".
I’m super stuck here. It’s likely because I don’t understand something. Can someone help me see the light?
OK, so I didn't realize this, but you can type into the dropdown box. So even though the drop down options say "No options", I can type in a partition key name "_partition" (or whatever). This is from a MongoDB person:
... On that screen, instead of using the dropdown, you can type in whatever field name you intend to use for the partition value. We generally use "_partition".
I have data in mongodb in one project.I am integrating this project functionality to another project,so I want to get whole data from the project and insert into this integration project.so much like data migration.
There is 2 parts to this.
First is the actual migration of date from 1 dB to another, u can use a any random tool to do that.
2nd is the docker networking part. So you can either get them to talk to each other by their ip, you can see them via docker inspect. However u need to manually do this everytime, the other is to use host.docker.internal, which means it will route it via your host pc, saving u having to find the up each time.
I tried to connect AppMaker to an existing Google SQL database without success. In Google Cloud, I created a second generation instance (europe-west1) and allow every IP (for the test). Next, I created a user, connected Workbench with the database and created a schema. Without problems.
In AppMaker I use the following address to connect to the database:
[domainName:]myprojectID:regionName:myinstanceID/mydatabase
(with and without domain)
Feedback:
Unable to connect to Google Cloud SQL instance.
The Google Cloud SQL address may be incorrect or this App Maker editor may not have permission to access the database. You can find more information about using Google Cloud SQL in our documentation.
How can I connect to Google SQL with AppMaker?
Thanks.
The process I followed to connect to the database is the following:
Create a second generation instance by following the steps here (Please make sure to follow the steps only for "Create a Cloud SQL instance" and then create a database inside that instance)
Now, go to the IAM & ADMIN section of your project. Click on the blue "add" member option on the top. Type "appmaker-maestro#appspot.gserviceaccount.com" on the "Members" field and from the "Roles" dropdown select Project->Editor
Return to your second generation SQL instance and copy the value of the Instance connection name property of your instance. Example:
Follow the steps for second generation found here to connect to the database from AppMaker and when asked for the instance address, type the value you copied on the previous step and add /yourdatabase at the end of it. For example: my-foto-app:us-central1:myinstance/userphotodatabase
You should now be asked to enter the user and password. Do so and you are finished.
Please note that I haven't tested out this with a europe location but only on a us central location. I hope this helps and works!
Second generation instances are not yet supported by App Maker, switch to first generation and it will work.
FYI, 2nd gen Cloud SQL is supported bv App Maker and has been for awhile.
As of today, Postgre is not yet supported.
I am attempting to setup a rails 3.2 app on Google compute engine, not app engine. I want to use Google cloud sql. When reading the docs I know I need to assign access ips, however the ability to do that is no where to be found. I can allow app engine applications, but not an ip.
The edit menu in the console doesn't seem to have what I need even though the docs point me there.
Has anyone done this? Where and how do you assign an ip to your Google cloud sql instance?
Go to https://console.developers.google.com/project
Choose your project and click it's name
Click cloud SQL on the left side menu
Choose the instance ID you wish to assign an ip to and click it's name
Click edit
Scroll down past 'Resources and Billing'. Just below 'Options' is an 'Assign IP Address' section