get_custom_table_collection( $mongo_table ); return $collection->updateOne( array( $primary_key => $primary_value ), array( '$set' => $data ), array( 'upsert' => true ) ); } /** * Delete data from the table using primary key. * * @param string $mongo_table Table Name. * @param string $primary_key Primary key. * @param int $primary_value Primary Value. * * @return DeleteResult */ function acjpd_mongodb_delete_data( string $mongo_table, string $primary_key, int $primary_value ): DeleteResult { $collection = ( new Connector() )->get_custom_table_collection( $mongo_table ); return $collection->deleteOne( array( $primary_key => $primary_value ) ); }