MONGO the storage of data is very arbitrary, it becomes more complex when you need to modify an array object in an object.
Class objects in a class can be passed directly through the "." Example: Department.User.name
The object in the class is an array that can be written with department.$.name, but it must be updated with Department.1.name
This kind of writing to indicate the array below the table, it seems to feel very diao.
Attach a piece of code: easy to understand
varSspoper = Jingjiaoperationday.sspoper.FirstOrDefault (E = e.opertype.equals (operationtype) &&e.ssp.equals (SSP)); if(Sspoper! =NULL) { varIndexoper =jingjiaoperationday.sspoper.IndexOf (Sspoper); varUpdateQuery = Query.and (Queryoperationday, Query.eq ("Sspoper."+ Indexoper +". Opertype", Operationtype), Query.eq ("Sspoper."+ Indexoper +". SSP", SSP)); varSetsspcount = Update.set ("Sspoper."+ Indexoper +". Count", Sspoper.count +1);//Current Operating Volume +1jingjiaoperationday.update (UpdateQuery, Setsspcount); }
C # Manipulation of MongoDB array objects