![](/img/trans.png)
[英]MongoDB Mutation Upsert - Can't Get Id of New Record on First Submit
我在 MongoDB 上執行更新插入突變以創建新文檔或更新現有文檔。 如果文檔存在,突變會按預期返回 id。 如果創建了一個新文檔,則突變會在初始返回中返回 null(在 Apollo 沙箱中和通過 console.log),然后在后續返回中它將返回 id。 我需要它立即返回新創建文檔的 ID(在 ...
[英]MongoDB Mutation Upsert - Can't Get Id of New Record on First Submit
我在 MongoDB 上執行更新插入突變以創建新文檔或更新現有文檔。 如果文檔存在,突變會按預期返回 id。 如果創建了一個新文檔,則突變會在初始返回中返回 null(在 Apollo 沙箱中和通過 console.log),然后在后續返回中它將返回 id。 我需要它立即返回新創建文檔的 ID(在 ...
[英]Can't catch graphQL Error. Keep to showing Unhandled Runtime Error
當我收到 GraphQL 錯誤時,我想顯示一些模式或消息。 當然,我通過這樣添加得到了錯誤控制台。 但仍然在屏幕上顯示未捕獲的錯誤。 https://prnt.sc/_cD9KTlB94kA 我該如何處理錯誤? 謝謝。 ...
[英]How to catch returned value from mutation in another mutation Vuex
我正在嘗試從一個操作中訪問一個 getter,但它給出了一個錯誤: getters.isCardLiked is not a function 商店/index.js export const getters = { isCardLiked(state, id) { const found = s ...
[英]The arguement passed inside a function becomes undefined
這是我使用 pID 和 updatedBy 進行 API 調用的另一個函數,在 pID 正常的情況下,updatedBy 變為未定義。 ...
[英]How to make a sample that shows the 'Props are overwritten when re-rendering' anti pattern
我想確信“重新渲染時 Props 被覆蓋”是一種反模式。 更新代碼筆: https://codepen.io/SVSMITH/pen/LYrXRzW 誰能幫忙? ...
[英]sending value of my textarea with graphql
我希望你們都有美好的一天。 我正在編寫自己的個人網站,並且有一個部分可以聯系我。 我在這部分遇到的問題是,我試圖將我的客戶端 email 發送到我的 email,當我試圖通過 Graphql 將他們的消息發送到我的服務器時,我收到此錯誤 我發送到服務器的請求是 我不知道如何解決它 我不知道為什么會出 ...
[英]ComponentDidUpdate treates prevState and this.state as equal
我有我的 state,我用這個 function 更新了它: 起初看起來像這樣,但據我所知這是一種變異的方式,所以我用上面的版本改變了它: 我有我的 ComponentDidUpdate: 我的問題是我的兩個變量prev和curr始終相等, isStateChanged - 始終返回true ,即使 ...
[英]Not able to understand random.sample(range(1,40),3)) with sum(1<<i for i in random.sample(range(1,40),3))
我正在嘗試調試這段代碼並學習一些東西。 我了解到它為i生成了 3 個唯一值,但是sum的值怎么會變得這么大呢? 如果我運行它並調試它,它會像這樣。 它保持變化,因為值是隨機選擇的。 i = 6 i = 26 i = 38 test_num = 274945015872 Output: 1000 ...
[英]Cross-over is failing binary encoded string
我正在實施 G.netic 算法 (GA)。 有43個號碼[救護車位置]可供選擇(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ...
[英]Controlling Mutation in 39bit string as a candidate solution in genetic algorithm
我正在研究優化問題。 我有X個救護車位置,其中X的范圍是1-39 。 有43個號碼[救護車位置]可供選擇(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ...
[英]Mutation with String Encoded Chromosomes - Genetic Algorithm
我正在實施 G.netic 算法 (GA)。 有43個號碼[救護車位置]可供選擇(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ...
[英]Cross-Over with string Encoded Chromosomes
我正在實施 G.netic 算法 (GA)。 有43個號碼[救護車位置]可供選擇(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ...
[英]How to watch any changes in object animation svg
我需要觀察 att object animation svg 的變化 我需要用 if (window2 === true) {...} 編寫代碼但我不明白如何查看此參數中的任何更改 isLoaded in svg animation 在開始頁面 window2 之后有錯誤並且在 animation ...
[英]Changing the numbers in a list to half their value
我正在嘗試將列表中的數字從任何給定列表更改為其值的一半。 我不知道當我開始時列表會是什么,只需要斷言 function 正在工作。 這是我到目前為止所擁有的: def halve_values(a): for index in range(len(a)): index /= 2 return in ...
[英]How to add extra values from 2 arrays to end of new array
例如,如果我有 2 個 arrays 是: let array1 = [1,2,3]; 並let array2 = [5,6,7,8,9] ,我將如何創建一個新的第三個數組,該數組僅包含 array2 中位於額外索引處的元素(因此新數組將僅包含 [8,9]因為它們位於索引 3 和 4)。 謝謝! ...
[英]Infinite calls to the callback from useEffect when the state changes for the first time
我有一個父組件將回調 function 傳遞給子組件,這樣每當子組件中數組的 state 發生變化時,都會調用回調。 出於某種原因,每當我第一次更改子組件中的 state 時,它都會導致無限循環,其中回調會永遠被調用。 這是下面的真實代碼。 當用戶在列表中添加新書時,我已經定義了一個突變來設置sim ...
[英]How to filter an array inside an object?
我正在努力在一個條件下過濾object內的數組(在我的情況下,如果 value1 <> value2和toggle 為真,則過濾) 所以我的 output 應該是 我創建了這個名為“filterObject”的 function,它在參數“myObject”和“toggle”中具有(如 ...
[英]Mutation function returned by useMutation not passing variables
我正在嘗試使用 useMutation 掛鈎返回的突變 function 來創建用戶(稍后我也必須進行登錄突變),但是在 createUser() function 上傳遞的變量沒有被傳遞。 這是我的注冊表單代碼: 這是 .graphql 文件,其中包含由 loader() function 加載的 ...
[英]What is mutation in C#?
我正在閱讀 Joseph Albahari 的書“C# 10 in a Nutshell”,它談到了“匿名類型的非描述性突變”,但我什至不知道什么是突變,在谷歌上我只能找到“突變測試”或“什么是非破壞性突變?” 它們總是作為記錄類型的附帶功能而告終。 有人可以把它分解給我嗎? 一些例子將不勝感激! ...
[英]Replace an item at a specific index with vs without mutation
最近我遇到了這兩種解決方案來替換數組中特定索引處的項目,但我想知道哪個更好,為什么?function replace(array, index, item) { const newArray = [...array]; newArray[index] = item; return new ...