======= Library for connection to MongoDB with PHP7
This library help you to use perform MongoDB based queries just like active record in CodeIgniter.
This library support
- Write Concern and Journal
- Read Preference
- Aggregation Framework
- Query Profiling
The library needs the following items to run: MongoDB/MongoDB MongoDB Extensions
This framework is based on the following library: https://github.com/ehoutsma/Codeigniter-mongo-library
#Methods
##Insert Method
insertInsert a new document into a collectionbatch_insertInsert multiple new documents into a collection
##Select Method
selectGet select fields from returned documentswhereORget_whereWhere section of the querywhere_inWhere something is in an array of somethingwhere_in_allWhere something is in all of an array of * somethingwhere_not_inWhere something is not in array of somethingwhere_orWhere something is based on orwhere_gtWhere something is greater than somethingwhere_gteWhere something is greater than or equal to somethingwhere_ltWhere something is less than somethingwhere_lteWhere something is less than or equal to somethingwhere_betweenWhere something is in between to somethingwhere_between_neWhere something is in between and but not equal to somethingwhere_neWhere something is not equal to somethinglikeWhere something is search by like queryorder_byOrder the resultslimitORoffsetLimit the number of returned resultscountDocument Count based on where querydistinctRetrieve a list of distinct values for the given key across a single collectionfind_oneRetrieve single document from collection
##Update Method
setSets a field to a valueunset_fieldUnsets a fieldaddtosetAdds a value to an array if doesn't existpushPushes a value into an array fieldpopPops a value from an array fieldpullRemoves an array by the value of a fieldrename_fieldRename a fieldincIncrements the value of a fieldmulMultiple the value of a fieldmaxUpdates the value of the field to a specified value if the specified value is greater than the current value of the fieldminUpdates the value of the field to a specified value if the specified value is less than the current value of the field.updateUpdate a single document in a collectionupdate_allUpdate all documents in a collection
##Delete Method
deleteDelete a single document in a collectiondelete_allDelete all documents in a collection
##Aggregation Method
aggregatePerform aggregation query on document
##Profiling Methods
output_benchmarkreturn complete explain data for all the find based query performed
##Index Method
add_indexCreate a new index on collectionremove_indexRemove index from collectionlist_indexesShow all index created on collections
##DB Method
switch_dbSwitch to a different databasedrop_dbDrops a databasedrop_collectionDrops a collection
##Extra Helper
dateCreate or convert date to MongoDB based Date
##License Creative Commons Attribution 3.0 License. Codes are provided AS IS basis, i am not responsible for anything.