Download the PHP package payamjafari/mongocute without Composer
On this page you can find all versions of the php package payamjafari/mongocute. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mongocute
MongoCute - A QueryBuilder for MongoDB
By using this builder you can easily make your database queries without writing raw queries.
Installation
Usage
Just call method "query" in QueryBuilder class and you are ready.
Environment config
You can set your configuration in your project root folder by creating a file named ".env"
Filter query
For filtering your query you can use several methods such as where
, whereNot
, orWhere
, ...
.
Filter Methods
Name | Description |
---|---|
whereEqual( string $name, $value ) |
Matches values that are equal to a specified value. |
whereNot( string $name, $value ) |
Matches all values that are not equal to a specified value. |
whereIn( string $name, array $values ) |
Matches any of the values specified in an array. |
whereNotIn( string $name, array $value ) |
Matches none of the values specified in an array. |
whereGreaterThan( string $name, $value ) |
Matches values that are greater than a specified value. |
whereGreaterThanOrEqual( string $name, $value ) |
Matches values that are greater than or equal to a specified value. |
whereLessThan( string $name, $value ) |
Matches values that are less than a specified value. |
whereLessThanOrEqual( string $name, $value ) |
Matches values that are less than or equal to a specified value. |
whereExists( string $name, $value ) |
Matches documents that have the specified field. |
whereType( string $name, $value ) |
Selects documents if a field is of the specified type. |
Note: All of these can be used with prefix 'or'
and also can be called statically from class.
Group Filter
You can set your filters as a group by just adding a closure to "where" method.
OrderBy
Select specific fields
Create/CreateMany
You can create a document by using "create" method or multiple by using "createMany" method.
Update
You can update documents by using "update" method.
Delete
You can delete documents by using "delete" method.
Select database at runtime
You can select your database at the query by calling "db" method.
Get first result
By calling method "first" at the last of your query, you can retrieve the first document taken.