0

This my doument

{ "_id" : ObjectId("57f65ed25ced690b5408a9d1"), "fbId" : "7854", "Name" : "user1", "pass" : "user1", "Watchtbl" : [ { "wid" : "745", "name" : "azs", "Symboles" : [ { "Name" : "nbv" } ] }, { "wid" : "8965", "name" : "bought stock1", "Symboles" : [ { "Name" : "AAA" }, { "Name" : "BSI" }, { "Name" : "EXXI" }, { "Name" : "AMD" } ] }, { "wid" : "9632", "name" : "bought stock3", "Symboles" : [ { "Name" : "AAA" }, { "Name" : "AMD" } ] } ] }

I want to find and update this record with a specific find, like I want to search by _id and wid and update the name and the Symboles of ths Watchtbl But it look _id and wid are not recognized when I try to do this filtre

var builder = Builders<BsonDocument>.Filter;
var filter = builder.Eq("_id", id) & builder.Eq("wid", wid);

it retrun 0.

So the ideaenter image description here is the same for Delete function

1 Answer 1

1

You will want to use builder.And to join clauses for your filter

var filter = builder.And(builder.Eq("_id", id), builder.Eq("wid", wid))

For updating the individual fields, you can achieve this using the

Builders<BsonDocument>.Update.Set

I hope this helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.