diff --git a/mongoDb/WiredTiger.turtle b/mongoDb/WiredTiger.turtle index e6f265aa6f4190e60e4209af8a1daf88eb7ebc4f..b2866dac707a14da85cd61704ee5bd1eba8aa858 100644 --- a/mongoDb/WiredTiger.turtle +++ b/mongoDb/WiredTiger.turtle @@ -3,4 +3,4 @@ WiredTiger 10.0.2: (November 30, 2021) WiredTiger version major=10,minor=0,patch=2 file:WiredTiger.wt -access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=10M),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.79=(addr="018781e454ad93559181e460686f589281e451fcb05d808080e3012fc0e24fc0",order=79,time=1710423867,size=32768,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=244,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=237,run_write_gen=1)),checkpoint_backup_info=,checkpoint_lsn=(1,127488) +access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=10M),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.173=(addr="018081e4087a73d78181e453b31e788281e47c6b2d6b808080e3012fc0e24fc0",order=173,time=1710435612,size=32768,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=298,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=518,run_write_gen=246)),checkpoint_backup_info=,checkpoint_lsn=(2,130048) diff --git a/mongoDb/WiredTiger.wt b/mongoDb/WiredTiger.wt index 79d74952256500017511fd336250ef7e934a3fba..3e5dc77e4d842bae143d96aaf0ffec6466800f14 100644 Binary files a/mongoDb/WiredTiger.wt and b/mongoDb/WiredTiger.wt differ diff --git a/mongoDb/collection-2-2489154932281691214.wt b/mongoDb/collection-2-2489154932281691214.wt index dde1a6c818ca21e5cb34e16b8f32d5ad781bd328..6ef103025a0af99a00c93424d378c6aee3e8662d 100644 Binary files a/mongoDb/collection-2-2489154932281691214.wt and b/mongoDb/collection-2-2489154932281691214.wt differ diff --git a/mongoDb/collection-4-2489154932281691214.wt b/mongoDb/collection-4-2489154932281691214.wt index 91f3544ff1e4ccd01bfaa7f55d883500c7f4df3a..d2ce4e415fd9c926cd9d1769fdbcf1483f97b04e 100644 Binary files a/mongoDb/collection-4-2489154932281691214.wt and b/mongoDb/collection-4-2489154932281691214.wt differ diff --git a/mongoDb/controllers/task.controller.js b/mongoDb/controllers/task.controller.js index e439ec2823f1f3d69dc4f5648055ef5ba2a5862a..79c08eb6aeb7311e3abdcac30180e6ec4aa3c4e5 100644 --- a/mongoDb/controllers/task.controller.js +++ b/mongoDb/controllers/task.controller.js @@ -19,8 +19,13 @@ const newTask = async (req, res) => { const deleteTask = async (req, res) => { - await Tasks.findByIdAndDelete(req.params.taskId); - res.status(200).json(null); + try { + await Tasks.findByIdAndDelete(req.params.taskId); + console.log(`--> book ${req.params.bookId} deleted`); + res.status(200).json(null); + } catch(error) { + throw error; + } } module.exports.allTasks = allTasks; diff --git a/mongoDb/diagnostic.data/metrics.2024-03-14T12-25-26Z-00000 b/mongoDb/diagnostic.data/metrics.2024-03-14T12-25-26Z-00000 index 14fd1ed539000ff1a3e52c3abda02fe685a12ade..676358aa4dd3a2281d9904f8950e79409db7afd3 100644 Binary files a/mongoDb/diagnostic.data/metrics.2024-03-14T12-25-26Z-00000 and b/mongoDb/diagnostic.data/metrics.2024-03-14T12-25-26Z-00000 differ diff --git a/mongoDb/diagnostic.data/metrics.2024-03-14T15-29-11Z-00000 b/mongoDb/diagnostic.data/metrics.2024-03-14T15-29-11Z-00000 new file mode 100644 index 0000000000000000000000000000000000000000..9990d8c5d03cd110694b21e6765644cd58ad6d59 Binary files /dev/null and b/mongoDb/diagnostic.data/metrics.2024-03-14T15-29-11Z-00000 differ diff --git a/mongoDb/diagnostic.data/metrics.interim b/mongoDb/diagnostic.data/metrics.interim index dd101166ad7b6d4c296b1c1b7135f15539748d37..7333d189b4b8b32e1d97ffdc31c988647e6695d5 100644 Binary files a/mongoDb/diagnostic.data/metrics.interim and b/mongoDb/diagnostic.data/metrics.interim differ diff --git a/mongoDb/index-3-2489154932281691214.wt b/mongoDb/index-3-2489154932281691214.wt index ed50af2f934632b063ef44f53621fab23cdf52c8..0755666096a74081c84cbc0bcaae7c6a83d5b121 100644 Binary files a/mongoDb/index-3-2489154932281691214.wt and b/mongoDb/index-3-2489154932281691214.wt differ diff --git a/mongoDb/index-5-2489154932281691214.wt b/mongoDb/index-5-2489154932281691214.wt index fca026661c95a4484fa642015f74cfc4b79e59d5..10979a5b73ebe27638e1895d917f055cb9c9b7a6 100644 Binary files a/mongoDb/index-5-2489154932281691214.wt and b/mongoDb/index-5-2489154932281691214.wt differ diff --git a/mongoDb/index-6-2489154932281691214.wt b/mongoDb/index-6-2489154932281691214.wt index 84d9c08ff4fadf59ab1fa36a043b41d8bc0f0159..ea67ed19e7fd0edbd0cfd75083c1b53c97ecd3e5 100644 Binary files a/mongoDb/index-6-2489154932281691214.wt and b/mongoDb/index-6-2489154932281691214.wt differ diff --git a/mongoDb/journal/WiredTigerLog.0000000001 b/mongoDb/journal/WiredTigerLog.0000000002 similarity index 99% rename from mongoDb/journal/WiredTigerLog.0000000001 rename to mongoDb/journal/WiredTigerLog.0000000002 index 2da4607db30c7396f404af402eb7716d856dffd0..df1c81a857e0c776f2b232bdc7748012ac74d1d5 100644 Binary files a/mongoDb/journal/WiredTigerLog.0000000001 and b/mongoDb/journal/WiredTigerLog.0000000002 differ diff --git a/mongoDb/mongod.lock b/mongoDb/mongod.lock index fe82e8eb78e51b8ac47cf11f17e86ece039a0d04..2255f8418d07415de3b558cd7f76d362bbf3ed3b 100644 --- a/mongoDb/mongod.lock +++ b/mongoDb/mongod.lock @@ -1 +1 @@ -1740508 +1681324 diff --git a/mongoDb/public/javascripts/todo.js b/mongoDb/public/javascripts/todo.js index b3ae3b904687be3e193ba7e6710ff6c20e2f222e..9aaca4d949c8f5331fd5101e5595d19a4ccc80f5 100644 --- a/mongoDb/public/javascripts/todo.js +++ b/mongoDb/public/javascripts/todo.js @@ -4,6 +4,8 @@ const setup = () => { displayMessage('prĂȘt'); } +let alltasks; + const fillTable = async () => { const tasksTable = document.getElementById('list'); tasksTable.textContent = ''; @@ -11,16 +13,17 @@ const fillTable = async () => { method: 'GET' }; const response = await fetch('/task/', requestOptions); - const alltasks = await response.json(); + alltasks = await response.json(); - alltasks.forEach(task => tasksTable.appendChild( buildTaskElement(task) ) ); + alltasks.forEach(task => tasksTable.appendChild( buildTaskElement(task, task._id)) ); } -const buildTaskElement = task => { +const buildTaskElement = (task, id) => { const taskElement = document.createElement('tr'); taskElement.className = 'task'; taskElement.appendChild(buildTD(task.description, 'description')); taskElement.appendChild(buildTD(task.urgency, 'urgency')); + taskElement.appendChild(buildButton('delete', 'x', id)); return taskElement; } @@ -31,6 +34,24 @@ const buildTD = (content, className) => { return TDelement; } +const buildButton = (className, content, id) => { + const button = document.createElement('button'); + button.textContent = content; + button.className = className; + button.addEventListener('click', deleteTask.bind(null, id)); + return button; +} + +const deleteTask = async (bookId) => { + const requestOptions = { + method: 'DELETE' + }; + await fetch(`/task/:taskId=${bookId}`, requestOptions); + // const otherBooks = alltasks.filter( task => task._id !== bookId); + // const tasksTable = document.getElementById('list'); + // otherBooks.forEach(task => tasksTable.appendChild( buildTaskElement(task) ) ); + // alltasks = otherBooks; +} fillTable(); // go ! setup(); diff --git a/mongoDb/routes/taskRouter.js b/mongoDb/routes/taskRouter.js index e43d06d3b6407e1fba31fb60e0c653d55f8940ab..52731d2d0b971fe2fa77adc6d4be7ef5ce548b3b 100644 --- a/mongoDb/routes/taskRouter.js +++ b/mongoDb/routes/taskRouter.js @@ -7,6 +7,6 @@ const taskController = require('../controllers/task.controller'); /* GET home page. */ router.get('/', taskController.allTasks); router.post('/', taskController.newTask); -router.delete('/?', taskController.deleteTask); +router.delete('/:taskId', taskController.deleteTask); module.exports = router; diff --git a/mongoDb/sizeStorer.wt b/mongoDb/sizeStorer.wt index 0f31d93ba4f9b02fe6a2fb25055aed5d5b0969de..190d6b0622c34f27429112e28c630336b497420f 100644 Binary files a/mongoDb/sizeStorer.wt and b/mongoDb/sizeStorer.wt differ