Hey guys, Im running the following bit of code, I'm getting exceptions thrown from mongo that say "norepl", and that's it. You'll notice I'm using my own class for dealing with the MongoPHP driver, this is insignificant, the methods just run the query and return the result, nothing special in between.
18 if($userId) {
19
20 $criteria = array('fbid'=>$userId);
21 $checkLoc = $db->select('users',$criteria);
22 foreach($checkLoc as $user);
23
24
25 foreach($_POST as $key=>$value) {
26 $values[$key] = $value;
27 }
28
29 $newupdate = array('$set' => array(
30 'address' => $values['profile-address-value'],
31 'age' => $values['profile-age-value'],
32 'business_name' => $values['profile-business-value'],
33 'capacity' => $values['profile-capacity-value'],
34 'comments' => $values['profile-comments-value'],
35 'drive' => $values['profile-driving-value'],
36 'exp' => $values['profile-years-value'],
37 'firstaid' => $values['profile-firstaid-value'],
38 'pets' => $values['profile-pets-value'],
39 'smoking' => $values['profile-smoking-value'],
40 'type' => $values['profile-type-value'],
41 'vacancy' => $values['profile-vacancy-value']));
42
43
44 // UPDATE USER INFO
45 try {
46 $db->update('users', $criteria, $newupdate);
47 } catch (Exception $e) {
48 $error[] = 'failed to update user info: '.$e->getMessage();
49 $success = 500;
50 } // THIS IS THROWING THE NOREPL EXCEPTION
51
52
53 // IF LOCATION HAS CHANGED
54 if($user['address'] != $_POST['profile-address-value']) {
55
56 $update2 = array();
57
58 // GEOCODE ADDRESS TO GET LATLNG
60 $newLoc = json_decode(file_get_contents($uri));
61
62 // ASSIGN OBJECTS TO VARIABLES
63 $lat = $newLoc->results[0]->geometry->location->lat;
64 $lng = $newLoc->results[0]->geometry->location->lng;
65
66 $update2['$set']['loc.0'] = $lat;
67 $update2['$set']['loc.1'] = $lng;
68
69 // UPDATE LATLNG
70 try {
71 $db->update('users', $criteria, $update2);
72 } catch (Exception $e) {
73 $success = 500;
74 $error[] = 'failed to update location. '.$e->getMessage();
75 } // THIS IS ALSO THROWING THE NOREPL EXCEPTION
76 }
77
78
79 }
This has been driving me crazy for weeks, I would very much appreciate some help solving this issue, I have to get this working.
Thank you in advance for your time and brainpower.
Cheers,
Cody