The structure stored in MongoDB is as follows:
public class Questioninfo
{
public int _id {get; set;}//Question ID
Public list<questionsameinfo> samequestions {get; set;}//A set of questions similar to the participle of the topic
Public list<questionsameinfo> samebody {get; set;}//Set of questions similar to the text of the question
public int hasimg {get; set;}//whether there is a picture, 1 is yes, 0 is no
public string Ways {get; set;}//parsing
public int Waysize {get; set;}//Length of resolution
public string Bodymd {set; get;}
}
public class Questionsameinfo
{
public int _id {get; set;}//Question ID
Public double same {get; set;}//Similarity
public int Size {get; set;}//Text length
}
If the structure of MongoDB as shown above, known as the _id of a problem and samequestions in the _id of an item, want to delete an item in samequestions based on these two IDs.
If the _id of the test is the _id of an item in Sid,samequestion, you can write the following code:
var helper = new MongoHelper2 (conn,table);
var query=query.eq ("_id", sid);
var update=update.pull ("Samequestions", Query.eq ("_id", mid));
var result = Helper. Updateone (query, update);
Remove an item from the list in MONGO with the C # driver