Thursday, November 9, 2017

MongoDB Search Collections

Document:
{
    "_id" : ObjectId("5a046e1151c456a18a6146f5"),
    "name" : [ 
        "bmw", 
        "bav motor wagen"
    ],
    "class" : {
        "usa" : "suv",
        "europe" : "compact"
    },
    "speed" : [ 
        {"mph" : 100}, 
        {"kph" : 120}
    ]
}
search query width and criteria, array match, object match
db.getCollection('cars').find({
    "name":"bmw",
    "class.usa": "suv",
    $and :[ 
        {"speed.0.mph": { $eq:100 }}, 
        {"speed.1.kph": { $eq:120 }} 
   ]
}
)

Friday, November 3, 2017

Install and Test Symfony Application with Node.JS

This will automate the process. You only need to enter passwords for mysql root or other mysql user and database name in install node.
To speed up symfony instalation and testing use package.json
{
  "scripts":{
    "install":"git clone https://github.com/nikola-bodrozic/sym28-patterns sym28 && cd sym28 && composer install && mysql -u root -p test < database.sql",
    "test":"cd sym28 && php phpunit-5.7.phar -c app/"
  }
}

in console run

npm install
npm test