Exploring NoSQL with Suissa

Exploring NoSQL with Suissa
paly

Learn from Jean Carlo Nascimento aka Suissa, his expertise on NoSQL databases. From what is NoSQL to where and why to use them, visit his Github and Nosqlbr.com.br.

About Exploring NoSQL with Suissa

PowerPoint presentation about 'Exploring NoSQL with Suissa'. This presentation describes the topic on Learn from Jean Carlo Nascimento aka Suissa, his expertise on NoSQL databases. From what is NoSQL to where and why to use them, visit his Github and Nosqlbr.com.br.. The key topics included in this slideshow are . Download this presentation absolutely free.

Presentation Transcript


1. com Jean Carlo Nascimento aka SUISSA

2. github.com/suissa about.me/suissa nosqlbr.com.br @osuissa

3. NOSQL O que ? Quais so? Por que usar? Onde usar?

12. key/value

14. graph

24. Terminologia SQL RDBMS DATABASE TABLE ROWS QUERY INDEX PARTITION MongoDB DATABASE COLLECTION JSON DOCUMENT QUERY INDEX SHARD

25. INSERIR INSERT INTO USERS VALUES(1,1) $db->users->insert(array("a" => 1, "b" => 1)); //ou $query = array( 'usuario' => "suissa", 'email' => "jnascimento@gmail.com" ); $db->collection->insert($query);

26. CONSULTAR select * from tabela where nome = 'Jean Nascimento' $filter = array( "nome" => "Jean Nascimento" ); $cursor = $collection->find($filter); foreach ($cursor as $arr) { echo $arr["nome"]. " - " . $arr["_id"] . "
"; }

27. CONSULTAR select * from tabela where nome LIKE 'J___ Nascimento' $filter = array( "nome" => new MongoRegex('/^J[a-Z]{3} Nascimento/i' ); select * from tabela where nome LIKE '%Nasc%' $filter = array( 'title' => new MongoRegex('/.Nasc./i') );

28. ALTERAR update tarefas set Tarefa='Terminar artigo' where Usuario='suissa' $db->collection->update( array('Usuario'=> 'suissa'), array('$set' => array('Tarefa' => 'Terminar artigo')) ); update users set a=a+2 where b='q' $db->users->update(array("b" => "q"), array('$inc => array("a" => 2)));

29. EXCLUIR delete from usuarios where Usuario = 'suissa' $db->collection->remove(array('Usuario'=> 'suissa'));

30. EXPLAIN EXPLAIN SELECT * FROM users WHERE z=3 $db->users->find(array("z" => 3))->explain()

34.

35. Talk is cheap. Show me the code .

36. $nome_banco = prioridades; $nome_collection = tarefas; $this->conexao = new Mongo(); $this->db = $this->conexao->$nome_banco; $this->collection = $this->db->$nome_collection;

37. function inserir(){ $this->query = array( UsuarioID => $this->UsuarioID, Usuario => $this->Usuario, Tarefa => $this->Tarefa, Tipo => $this->Tipo,//Obrigatrio, idia, outro Prioridade => $this->Prioridade); $this->collection->insert($this->query); }

38. function excluir(){ $this->mongo_id = new MongoID($this->_id); $this->collection->remove(array(_id => $this->mongo_id)); }

39. function mudar_tarefa(){ $this->mongo_id = new MongoID($this->_id); $this->collection->update(array(_id => $this->mongo_id), array($set => array(Tarefa => $this->Tarefa)), false); }

40. function mudar_tarefa(){ $this->mongo_id = new MongoID($this->_id); $this->collection->update(array(_id => $this->mongo_id), array($set => array(Tarefa => $this->Tarefa)), false); }

41. function mudar_prioridade(){ $this->mongo_id = new MongoID($this->_id); if($this->modo==up){ $this->collection->update( array(_id => $this->mongo_id), array($inc => array(Prioridade => 1)), false ); } elseif($this->modo==down){ $this->collection->update( array(_id => $this->mongo_id), array($inc => array(Prioridade => -1)), false ); } }

42. https://github.com/suissa/mon godb-exemplos

43. Frameworks CakePHP Codeigniter Doctrine Drupal Fat-Free Kohana Lithium Memcached Symfony 2 TechMVC Vork Yii Zend

44. Standalone Tools ActiveMongo MapReduce API Mongofilesystem Mandango MongoDb PHP ODM Mongodloid MongoQueue MongoRecord Morph simplemongophp Uniform Server 6-Carbo with MongoDB and phpMoAdmin

45. Referncias http://www.nosqlbr.com.br/ http://nosql-database.org/ http://pt.wikipedia.org/wiki/NoSQL http://www.mongodb.org/