Hızlı Başlangıç Kılavuzu: Veritabanı oluşturma ve veritabanına bağlanma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Yalnızca Cloud Firestore Enterprise sürümü için geçerlidir.
MongoDB uyumluluğu olan bir Cloud Firestore veritabanı oluşturmayı ve mongosh aracıyla bu veritabanına bağlanmayı öğrenin.
Başlamadan önce
Henüz yapmadıysanız bir Firebase projesi oluşturun: Firebase konsolundaProje ekle'yi tıklayın, ardından Firebase projesi oluşturmak veya mevcut bir Google Cloud projesine Firebase hizmetleri eklemek için ekrandaki talimatları uygulayın.
MongoDB uyumluluğu olan bir Cloud Firestore veritabanı oluşturma ve bağlantı dizesini alma
Firebase konsolunda yeni bir Firestore Enterprise sürümü veritabanı oluşturun.
MongoDB uyumluluğu olan Cloud Firestore için Firestore Enterprise sürümü gerekir:
Kullanıcı için bir Identity and Access Management rolü seçin.
Oluştur'u tıklayın. Veritabanı bir kullanıcı oluşturur ve kullanıcının oluşturulan şifresini gösterir. Bu şifreyi kopyalayıp kaydedin. Bu şifreyi daha sonra geri alamazsınız..
mongosh kullanarak bağlanma
Veritabanınıza bağlanmak için bağlantı dizesini, kullanıcı adını ve şifreyi kullanın. Ardından, aşağıdaki yapılandırma seçenekleriyle mongosh komutunu yerel olarak çalıştırın.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-09-05 UTC."],[],[],null,["\u003cbr /\u003e\n\n\n|--------------------------------------------------------|\n| *Relevant to Cloud Firestore Enterprise edition only.* |\n\n\u003cbr /\u003e\n\nLearn how to create a Cloud Firestore with MongoDB compatibility database and connect to it with the\n`mongosh` tool.\n\nBefore you begin\n\n1. If you haven't already, create a Firebase project: In the [Firebase console](//console.firebase.google.com/), click **Add project** , then follow the on-screen instructions to create a Firebase project or to add Firebase services to an existing Google Cloud project.\n2. [Install the `mongosh` tool](https://www.mongodb.com/docs/mongodb-shell/install/)\n\n\u003cbr /\u003e\n\nCreate a Cloud Firestore with MongoDB compatibility database and retrieve the connection string In the Firebase console, create a new Firestore Enterprise edition database. Cloud Firestore with MongoDB compatibility requires Firestore Enterprise edition:\n1. In the Firebase console, go to the **Firestore Database** page.\n\n [Go to Firestore Database](//console.firebase.google.com/project/_/firestore/databases/-default-/data/)\n2. Click the database that you want to authenticate.\n3. In the **Explorer** panel, click more_vert **View more**.\n4. Select **Connect using MongoDB tools**.\n5. Copy the connection string.\n\n\u003cbr /\u003e\n\nThe connection string depends on the UID of the database (system-generated)\nand the location of database: \n\n```text\nUID.LOCATION.firestore.goog\n```\n\nCreate a user for SCRAM authentication\n\nIn the Google Cloud console, create a new database user and assign\nthe user Identity and Access Management permissions.\n\n1. In the Google Cloud console, go to the **Databases** page.\n\n [Go to Databases](https://console.cloud.google.com/firestore/databases)\n2. Select the database from the list of databases.\n3. In the navigation menu, click **Auth**.\n4. Click **Add User**.\n5. Enter a username.\n6. Select an Identity and Access Management role for the user.\n7. Click create. The database creates a user and shows you the user's generated password. **Copy and save this password. You will not be able to retrieve\n this password later.**.\n\nConnect using `mongosh`\n\nUse the connection string, username, and password to connect to your\ndatabase, run `mongosh` locally with the following configuration options. \n\n```gdscript\nmongosh 'mongodb://\u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e:\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e@\u003cvar translate=\"no\"\u003eCONNECTION_STRING\u003c/var\u003e:443/\u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e?loadBalanced=true&authMechanism=SCRAM-SHA-256&tls=true&retryWrites=false'\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: the name of the database user you created.\n- \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: the generated password for the database user you created.\n- \u003cvar translate=\"no\"\u003eCONNECTION_STRING\u003c/var\u003e: the database connection string.\n- \u003cvar translate=\"no\"\u003eDATABASE_ID\u003c/var\u003e: a database ID\n\nOnce connected, you can create and read data, for example: \n\n```text\ndb.pages.insertOne({ message: \"Hello World!\"})\ndb.pages.find({})\nexit\n```\n\nWhat's next\n\n- [See a list of supported features](/docs/firestore/enterprise/supported-data-types-drivers)\n- [Learn about behavior differences in Cloud Firestore with MongoDB compatibility](/docs/firestore/enterprise/behavior-differences)\n- [Learn about additional authentication methods](/docs/firestore/enterprise/connect)"]]