title: RavenDb - Write query and select item where it's propertyName equals a string
body: <p>Is it possible to write a query and select an item where its <code>propertyName</code> equals a string?</p>
  
  <p>I want to pass in a string to a method, where my string holds the value of a <code>propertyName</code>. And then use it in a query to select my property that equals that string. Is this possible?</p>
  
  <p>I know I'm not writing any code here, just asking if this is possible to do.</p>
  
  <p>EDIT:
  Ok this as my solution a come up wth so far, and I know, it's far from a good solution. But I will put here and if you can give me a better solution, feel free to do it. Any help is a appreciated! </p>
  
  <p>This is one of the Raven-document I could work with:</p>
  
  <pre><code>  {
    "WelcomeHeader": "header",
    "WelcomeText": "some text",
    "Template": {
      "Id": "RouteConfigTemplates/1",
      "Name": "Index",
      "Controller": "Home",
      "Action": "Index",
      "View": "Index",
      "ContentPageType": "Core_StudioL.Models.IndexCorePage, Core_StudioL"
    },
    "Url": "/"
    "Title": "Start"
    }
  </code></pre>
  
  <p>Im my view a have a couple of WYSIWYG-editors, and each time I push the save button on one of my editors i sending the parameters to this mvc-controller-method below:</p>
  
  <p><code>string model</code> : is my whole model in json-format as string.</p>
  
  <p><code>string activeId</code> : is the id of the passed WYSIWYG-editors div (activeId = The sent propertys propertyName)</p>
  
  <p><code>string contentToUpdate</code> : is the value I want to update</p>
  
  <pre><code>[ValidateInput(false)]
      public JsonResult SaveContent(string model, string activeId, string contentToUpdate)
      {
          //parse model to json
          var modelAsJson = JObject.Parse(model);
  
          //if the property-name == item.key, replace it
          foreach (var item in modelAsJson)
          {
              if (item.Key == activeId)
              {
                  item.Value.Replace(contentToUpdate);
              }
          }
  
          //find the right contentPageType
          string cType = modelAsJson["Template"]["ContentPageType"].ToString();
  
          //convert back to string
          string newModel = modelAsJson.ToString(Formatting.None);
  
          //here I need to have many if-statments (not an optimal solution) to pick out the right contentPageType, here is a example of one of them.
          //The problem here
          if (cType.Equals("Core_StudioL.Models.IndexCorePage, Core_StudioL"))
          {
              var jsonSerializer = new JavaScriptSerializer();
              var modelAsCorrectModel = jsonSerializer.Deserialize&lt;IndexCorePage&gt;(newModel);
  
              //Here I'm having problem to update a single value, because the values sent in to the controller could be any..
              //So my ugly solution here is to delete the whole document from raven, and then save a new one with the updated values. If a just could only save the `string contentToUpdate`
              //
              var page = RavenSession.Load&lt;CorePage&gt;(modelAsCorrectModel.Id);
              RavenSession.Delete(page);
              RavenSession.SaveChanges();
  
              RavenSession.Store(modelAsCorrectModel);
              RavenSession.SaveChanges();
  
              var modelToReturn = new JavaScriptSerializer().Serialize(modelAsCorrectModel);
  
  
              return Json(modelToReturn);
          }
  
          return null;
      }
  </code></pre>
  
  <p>by doing it this way, my model in the razor-view never gets updated before I reload the page.
  That means: If a save on of my WYSIWYG-editors, it's content gets updated to ravendb.
  But if I save another one without refreshing the page after I saved the first one. 
  Then just that another one gets updated. Because the model sent in to the save-method is still the first model sent in to the view.
  So: the first one saved, then gets overwritten by the original Model, because it still holds the original models values!</p>