Created
December 13, 2018 18:38
-
-
Save parzibyte/2f5e026e284fe8620790e9ec4daa8a59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$baseDeDatos = obtenerBaseDeDatos(); | |
$coleccion = $baseDeDatos->contactos; | |
$resultado = $coleccion->updateOne( | |
// El criterio, algo así como where | |
["_id" => new MongoDB\BSON\ObjectId($id)], | |
// Nuevos valores, no es necesario poner todos pero aquí es para ejemplificar | |
[ | |
'$set' => [ | |
"campo" => "valor actualizado", | |
"otro campo" => "otro valor actualizado", | |
], | |
] | |
); | |
# Recuerda que puedes ver a cuántos afectó con $resultado->getModifiedCount() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment