Skip to content

Instantly share code, notes, and snippets.

$db = $mongoClient->test;
$taskcollection = $db->task_;
$taskDetailscollection = $db->task;
$taskDetailsdocument = array(
"creator" => "testing",
"callable" => "mailer:sendEmail",
"args" => array(),
"kwargs" => new \stdClass()),
"created" => new \MongoDate(),
{
"_id" : ObjectId("554b8092d700e9ae098b456e"),
"creator" : "testing",
"callable" : "mailer\nsendEmail",
"args" : [],
"kwargs" : {},
"created" : ISODate("2015-05-07T15:11:14.705Z"),
"state" : "new",
"owner" : null,
"result" : null
$inputFilter->add($factory->createInput(array(
'name' => 'cenLat',
'required' => true,
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array(
'messages' => 'YOUR CUSTOM ERROR MESSAGE',
'type' => array('integer', 'float'),
)
$inputFilter->add($factory->createInput(array(
'name' => 'lon',
'required' => true,
'validators' => array(
array(
array(
'name' => 'NotEmpty',
'options' => array(
'messages' => 'message'
)
use Zend\View\Helper\Url;
use Zend\Mvc\Router\Http\TreeRouteStack;
class MyUrl extends Url
{
public function __construct(TreeRouteStack $router)
{
$this->setRouter($router);
}
Works
$url = $this->getServiceLocator()->get('viewhelpermanager')->get('url');
$url('something');
Doesn't work
$this->url = $this->getServiceLocator()->get('viewhelpermanager')->get('url');
$this->url('something');
//First user created
use admin
db.createUser(
{
user: "admintest",
pwd: "testing",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
@dmregister
dmregister / gist:27ae6a81ab86442ca9db
Created April 8, 2015 16:24
mongo-connector error
Error
TypeError: 'Database' object is not callable. If you meant to call the 'disconnect' method on a 'MongoClient' object it is failing because no such method exists.
Error is happening here:
https://github.com/10gen-labs/mongo-connector/blob/master/mongo_connector/connector.py#L282
CMD:
mongo-connector -m 192.168.56.10:27017 -t 192.168.56.10:9200 -d elastic_doc_manager
Mongo conf:
$this->add(array(
'name' => 'email',
'required' => true,
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array(
'messages' => array(
\Zend\Validator\NotEmpty::IS_EMPTY => 'Email cannot be empty'
),
Boolean agentSuccessfullyUpdated = false;
Integer attempt = 1;
while (agentSuccessfullyUpdated == false) {
try {
dbCollection.update(new BasicDBObject(agentMuw.getQuery()), new BasicDBObject(agentMuw.getModifiers()), agentMuw.isUpsert(), agentMuw.isMultiUpdate());
agentSuccessfullyUpdated = true;
agentDbObjectForList.put("permalink", permalink);
} catch (Exception ex) {
ex.printStackTrace();