Mongo throwing norepl exception.
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
Cody Halovich <c... @telenova.ca>
Date: Fri, 5 Oct 2012 08:44:24 -0700 (PDT)
Local: Fri, Oct 5 2012 11:44 am
Subject: Mongo throwing norepl exception.
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 59 $uri = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($_POST['profile-address-value']) . '&sensor=false'; 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
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Kristina Chodorow <krist... @10gen.com>
Date: Tue, 9 Oct 2012 07:13:08 -0700 (PDT)
Local: Tues, Oct 9 2012 10:13 am
Subject: Re: Mongo throwing norepl exception.
This error happens when you try to use the w option without replication enabled. For example, if you were using a single server and did $db->update('users', $criteria, array("w" => 2)). w might be set on the database, collection, or individual write.
On the plus side, the write is still being written, Mongo is just unable to check that it's being written to multiple servers.
On Friday, October 5, 2012 11:44:24 AM UTC-4, Cody Halovich wrote:
> 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 > 59 $uri = ' > https://maps.googleapis.com/maps/api/geocode/json?address=' . > urlencode($_POST['profile-address-value']) . '&sensor=false'; > 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
You must
Sign in before you can post messages.
You do not have the permission required to post.