GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - clops/P4TMongo: P4TMongo is a PHP Class that mimics the popular AdoDB PHP Library. Use your favorite getOne, getRow, getAll, getCol and other commands with MongoDB.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
P4TMongo.class.php
P4TMongo.class.php
 
 
README.md
README.md
 
 

Repository files navigation

P4TMongo

P4TMongo is a PHP Class that mimics the popular AdoDB PHP Library. Use your favorite getOne, getRow, getAll, getCol and other commands with MongoDB.

Prerequisites

  • PHP Version 5.2+
  • PHP MongoDB Driver Version 1.2.6+
  • MongoDB Version 1.6+

Usage

This class is a layer above the MongoDB PHP Driver that implements most AdoDB functions. First you need to initialize a connection:

<?php
...
    include_once('P4TMongo.class.php');
    $db = new P4TMongo('mongodb://user.password@localhost');
    $db->setDBName('myDatabase');
    ...
?>

And then you can start using your favorite AdoDB functions with MongoDB right out of the box, for example:

<?php
    ...
    $filter = array(
                        'Gender' => 'male'
                    );

    //getOne returns one value
    $value = $db->getOne('myTestCollection', 'columnIWantToTakeValueFrom', $filter);
    
    //getCol returns one column
    $column = $db->getCol('myTestCollection', 'columnIWantReturned', $filter);
    
    //getRow returns one row
    $row = $db->getRow('myTestCollection', $filter);
    
    //getAll returns all rows
    $allDataInCollection = $db->getAll('myTestCollection', $filter);
    ...
?>

Supported getters are:

  • getOne()
  • getOneByID()
  • getCol()
  • getRow()
  • getRowByID()
  • getAll()
  • getAssoc()

How about inserting data?

<?php
    ...
    $record = array(
                    'Name' => 'Alehandro Coolikoff',
                    'Gender' => 'male',
                    'Age' => 30
                );
                
    $db->insert('myTestCollection', $record);
    ...
?>

There are also helper function for updating, deleting, counting, grouping and executing admin commands. Please check the function definitions for more details on possible usage options.

License

Copyright 2012 Alexey Kulikov / [email protected] / POOL4TOOL AG, Vienna, Austra

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

P4TMongo is a PHP Class that mimics the popular AdoDB PHP Library. Use your favorite getOne, getRow, getAll, getCol and other commands with MongoDB.

Resources

Readme
Activity

Stars

6 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.