I am using the 10gen C # driver for MongoDB and I would like to remove the subdocument from the subdocument. I do not know how to do that.
Here is an example of what looks like my document
{ "_id": "binary_stuff", "Name": "MyApplication", "Settings": [ { "_id": "binary_stuff", "Key": "ImportDirectory", "Value": "C:\data", "Overrides": [{ "_id": "binary_stuff", "Name": "PathDirectory", "Value": "C:\anotherData" }] }, }
And I want to remove the overridden name, which is PathDirectory. Here is the request that I wrote, but it does not work. I have no mistake.
var query = Query.And(Query.EQ("_id", applicationId), Query.EQ("Settings.Key", "ImportDirectory"), Query.EQ("Settings.$.Overrides.Name", "PathDirectory")); Run(database => database.Applications().Remove(query));
Thanks for any help. John
source share