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
Jan 12, 2016
by
Will Banfield
Committed by
Jeremy Mikola
Mar 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-159: rename uses UpdateOne() per the spec
parent
2ca40c7d
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
);
}
/**
...
...
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