Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4625

Find Method on collection object is not working. Saying 'MongoDB.Driver.MongoCollectionBase<MongoDB.Bson.BsonDocument>' does not contain a definition for 'Find'

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Works as Designed
    • Icon: Trivial - P5 Trivial - P5
    • None
    • None
    • None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      Summary

      Find Method on collection object is not working. Saying 'MongoDB.Driver.MongoCollectionBase<MongoDB.Bson.BsonDocument>' does not contain a definition for 'Find'

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      Driver version --->  2.19.1
      we are using Azure Cosmos DB for MongoDB account(RU) and server version 4.2

      How to Reproduce

      1. create Azure cosmost DB for MongoDB account(RU). version should be 4.2
      2. create a sample db and collection name.
      3. do write the following similar code,
       __ 
      using MongoDB.Driver;
      using MongoDB.Bson;
      var client = new MongoClient(connectionString);
      var database = client.GetDatabase("teacher_profile");
      var collection = database.GetCollection<BsonDocument>("chapters");
      var filter = Builders<BsonDocument>.Filter.Eq("_id", ObjectId.Parse("64439214f877fcad42b31c38"));
       var result = collection.Find(filter).FirstOrDefault();
       Console.WriteLine(result);

      Additional Background

      Please provide any additional background information that may be helpful in diagnosing the bug.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            punnammani@gmail.com manikanta punnam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: