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

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Works as Designed
    • Priority: Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: 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?
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Robert Stam (Inactive)
            Reporter:
            manikanta punnam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: