title: C# to upload data to Azure Cosmos DB SQL api
body: <p>I have following part of code which worked to upload data to CosmosDB Mongo API. Now I am using Cosmos Client to upload document to Cosmos DB SQL API. However, Below lines don't support in SQL api.</p>
  <pre><code>        var item = objs[i];
          var doc = BsonDocument.Parse(item.ToString());                    
          //saving all  the documents in cosmos
          listTask.Add(collection.ReplaceOneAsync(
              filter: new BsonDocument(&quot;id&quot;, doc[&quot;id&quot;]),
              options: new ReplaceOptions { IsUpsert = true },
              replacement: doc));
  </code></pre>
  <p>Is it possible to replace for SQL API?</p>
  <pre><code>private async Task UploadComplete(List&lt;object&gt; objs)
  {
      double total_cycles = (int)((double)objs.Count / BATCH);
      
      var cycle= 0;
      //configuring cosmos connection-SQL
      CosmosClient client = new CosmosClient(cosmos);
      var database = client.GetDatabase(cosmos_database);
      var collection = database.GetContainer(cosmos_collection);
  
             //works for Cosmos DB Mongo API
              var item = objs[i];
              var doc = BsonDocument.Parse(item.ToString());                    
              //saving all  the documents in cosmos
              listTask.Add(collection.ReplaceOneAsync(
                  filter: new BsonDocument(&quot;id&quot;, doc[&quot;id&quot;]),
                  options: new ReplaceOptions { IsUpsert = true },
                  replacement: doc));
  
            //Cosmos DB SQL API
            //Code here---------
            //------------------
  
  
  }
  </code></pre>