Download the PHP package shershams/lmongo without Composer
On this page you can find all versions of the php package shershams/lmongo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lmongo
LMongo
LMongo is MongoDB package for Laravel 4. Most part of LMongo is based on Illuminate/Database (Thanks to @taylorotwell)
Please note that LMongo project is under heavy development, some functionalities are not yet tested. Please report if you find any bug.
- Installation
- Basic Usage
- Query Builder
- Wheres
- Advanced Wheres
- Aggregates
- Inserts
- Updates
- Deletes
- Pagination
- Eloquent for MongoDB
- License
Installation
Add shershams/lmongo
as a requirement to composer.json:
And then run composer update
Once Composer has installed or updated your packages you need to register LMongo. Open up app/config/app.php
and find the providers
key and add:
Then find the aliases
key and add following line to the array:
Finally you need to publish a configuration file by running the following Artisan command.
This will copy the default configuration file to app/config/packages/shershams/lmongo/config.php
Basic Usage
You may get a MongoDB instance by calling the LMongo::connection
method:
This will give you an instance of the default MongoDB server. You may pass the server name to the connection
method to get a specific server as defined in your mongodb configuration:
LMongo uses magic method to pass the collection name to the Database class and return MongoCollection instance. Then you can use any of MongoCollection methods:
Get the MongoDB object:
Get the MongoClient object:
Select/switch the database:
Create the database:
Query Builder
Wheres
Retrieving All Rows From A Collection
Retrieving A Single Document From A Collection
Retrieving A Single Column From A Document
Specifying A Fields
Using Where Operators
Or Statements
Nor Statements
Using Where In And Where Not In With An Array
Using Where All With An Array
Using Where Exists
Using Where Gt
Using Where Gte
Using Where Lt
Using Where Lte
Using Where Between
Using Where Ne
Using Where Regex
Using Where Like
There are more where methods in Query/Builder.php file.
Order By
Offset & Limit
Advanced Wheres
Parameter Grouping
Aggregates
Distinct
Inserts
Inserting Document Into A Collection
Inserting Multiple Documents Into A Collection
Updates
Updating Documents In A Collection
Incrementing or decrementing a value of a column
Deletes
Deleting Documents In A Collection
Deleting All Documents From A Collection
Pagination
LMongo has pagination support like Laravel's Query Builder.
Eloquent for MongoDB
It's similar to Eloquent, except few differences:
- It has a
collection
property, nottable
- Primary key field is
_id
, notid
- No Pivot collections for "Many To Many" relationship. So don't use "Many To Many" relationships on a large datasets.
See Eloquent Docs.
License
Licensed under the MIT License.
TODO
- Aggregate/group support
- Indexes
- GridFS