index.php 651 B

1234567891011121314
  1. <?php
  2. require_once("../../../mdb/vendor/autoload.php");
  3. use MongoDB\BSON\ObjectId;
  4. use MongoDB\Client;
  5. // Requires the MongoDB PHP Driver
  6. // https://www.mongodb.com/docs/drivers/php/
  7. $client = new Client('mongodb://kpadmin:AnandAyyappan1981@127.0.0.1:27017/?authSource=kpmaster');
  8. $collection = $client->selectCollection('kpmaster', 'kpu');
  9. $return = $collection->updateOne(['_id' => new ObjectId('64b0f61b8b3742ad72109e80')], ['$set' => ['location' => ['coordinates' => [76.7682501,8.73673601],'type'=> "Point"]]]);
  10. printf("Matched %d document(s)\n", $return->getMatchedCount());
  11. printf("Modified %d document(s)\n", $return->getModifiedCount());
  12. ?>