Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
9b062ac0
Commit
9b062ac0
authored
Feb 08, 2020
by
Stas
Committed by
GitHub
Feb 08, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into drop-compound-index
parents
ca0f710a
c6313cb2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
2 deletions
+69
-2
.codacy.yml
.codacy.yml
+2
-0
BUG_REPORT.md
.github/ISSUE_TEMPLATE/BUG_REPORT.md
+25
-0
FEATURE-REQUEST.md
.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md
+18
-0
QUESTION.md
.github/ISSUE_TEMPLATE/QUESTION.md
+8
-0
Builder.php
src/Jenssegers/Mongodb/Query/Builder.php
+5
-1
ModelTest.php
tests/ModelTest.php
+9
-0
QueryBuilderTest.php
tests/QueryBuilderTest.php
+2
-1
No files found.
.codacy.yml
0 → 100644
View file @
9b062ac0
exclude_paths
:
-
'
.github/**'
.github/ISSUE_TEMPLATE/BUG_REPORT.md
0 → 100644
View file @
9b062ac0
---
name
:
"
Bug
report"
about
:
'
Report
errors
or
unexpected
behavior.'
---
-
Laravel-mongodb Version: #.#.#
-
PHP Version: #.#.#
-
Database Driver & Version:
### Description:
### Steps to reproduce
1.
2.
3.
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
<details><summary><b>
Logs
</b>
:
</summary>
Insert log.txt here (if necessary)
</details>
.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md
0 → 100644
View file @
9b062ac0
---
name
:
Feature request
about
:
Suggest an idea.
title
:
"
[Feature
Request]
"
---
### Is your feature request related to a problem?
A clear and concise description of what the problem is.
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
### Additional context
Add any other context or screenshots about the feature request here.
.github/ISSUE_TEMPLATE/QUESTION.md
0 → 100644
View file @
9b062ac0
---
name
:
Question
about
:
Ask a question.
title
:
"
[Question]
"
labels
:
'
question'
assignees
:
'
'
---
src/Jenssegers/Mongodb/Query/Builder.php
View file @
9b062ac0
...
...
@@ -700,7 +700,11 @@ class Builder extends BaseBuilder
*/
public
function
truncate
()
{
$result
=
$this
->
collection
->
drop
();
$options
=
[
'typeMap'
=>
[
'root'
=>
'object'
,
'document'
=>
'object'
],
];
$result
=
$this
->
collection
->
drop
(
$options
);
return
(
1
==
(
int
)
$result
->
ok
);
}
...
...
tests/ModelTest.php
View file @
9b062ac0
...
...
@@ -572,4 +572,13 @@ class ModelTest extends TestCase
$this
->
assertEquals
(
3
,
$count
);
}
public
function
testTruncateModel
()
{
User
::
create
([
'name'
=>
'John Doe'
]);
User
::
truncate
();
$this
->
assertEquals
(
0
,
User
::
count
());
}
}
tests/QueryBuilderTest.php
View file @
9b062ac0
...
...
@@ -175,7 +175,8 @@ class QueryBuilderTest extends TestCase
public
function
testTruncate
()
{
DB
::
collection
(
'users'
)
->
insert
([
'name'
=>
'John Doe'
]);
DB
::
collection
(
'users'
)
->
truncate
();
$result
=
DB
::
collection
(
'users'
)
->
truncate
();
$this
->
assertEquals
(
1
,
$result
);
$this
->
assertEquals
(
0
,
DB
::
collection
(
'users'
)
->
count
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment