Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
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
mongo-php-library
Commits
6aa739c4
Commit
6aa739c4
authored
9 years ago
by
Will Banfield
Committed by
Jeremy Mikola
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-159: rename uses UpdateOne() per the spec
parent
2ca40c7d
master
phplib-520
test-double-free
v1.1
v1.2
v1.3
v1.4
v1.5
v1.6
v1.7
1.7.0-beta1
1.6.0
1.5.2
1.5.1
1.5.0
1.4.3
1.4.2
1.4.1
1.4.0
1.3.2
1.3.1
1.3.0
1.2.0
1.2.0-alpha1
1.1.2
1.1.1
1.1.0
1.1.0-alpha1
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
Bucket.php
src/GridFS/Bucket.php
+2
-6
No files found.
src/GridFS/Bucket.php
View file @
6aa739c4
...
...
@@ -279,14 +279,10 @@ class Bucket
public
function
rename
(
ObjectId
$id
,
$newFilename
)
{
$filesCollection
=
$this
->
collectionsWrapper
->
getFilesCollection
();
$file
=
$filesCollection
->
findOne
([
'_id'
=>
$id
]);
if
(
$file
===
null
)
{
$result
=
$filesCollection
->
updateOne
([
'_id'
=>
$id
],
[
'$set'
=>
[
'filename'
=>
$newFilename
]]);
if
(
$result
->
getModifiedCount
()
==
0
)
{
throw
new
GridFSFileNotFoundException
(
$id
,
$this
->
collectionsWrapper
->
getFilesCollection
()
->
getNameSpace
());
}
$file
->
filename
=
$newFilename
;
$filesCollection
->
replaceOne
([
'_id'
=>
$id
],
$file
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
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