0

I seach a way to update a field(nth) from a document in my collection.

HERE IS MY COLLECTION FORMAT:

      {
       "_id" : ObjectId("526d498270c68c341b000000"),
       "login" : "testLogin",
       "name" : "testname",
       "email" : "testEmail",
       "saved_at" : ISODate("2013-10-27T17:12:34Z")
     }

I want to retrieve for example both the position and name for each field.

When I update a table in HTML table I retrieve a number of column and a number of row. The row number is the _id in my collection. That's how I do for deleting a whole row for example:

       $id=$_GET['id'];//Getting a row id 
       $collection->remove(array('_id' =>  new MongoID($id)));

For editing I would like something of this kind :

      $articles->update(array('_id' => new MongoId($c_id)),
      array('$set' => array('$FieldName' => '$new_value')));

but I can't get the "$Fieldname",I just have the column position of the changed field.So exactly I would like to retrieve $Fieldname['ColumnPosition']

Thanks !!!

Philipp
  • 67,764
  • 9
  • 118
  • 153
user222914
  • 75
  • 1
  • 10

0 Answers0