Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot create a string longer than 0x1fffffe8 characters #691

Open
bogere opened this issue Jan 23, 2022 · 1 comment
Open

Error: Cannot create a string longer than 0x1fffffe8 characters #691

bogere opened this issue Jan 23, 2022 · 1 comment

Comments

@bogere
Copy link

bogere commented Jan 23, 2022

I have been using the nedb for a good time but now I am getting funny errors after performing a test of million of records.. which were inserted successfully. But when I try to retrieve the records using db.find(), I get this error.

send this error to reporter Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (buffer.js:573:37)
    at Buffer.toString (buffer.js:770:14)
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:56:23) {
  code: 'ERR_STRING_TOO_LONG'
}

Environment
Window 10 Pro 64 bit... I was doing the test in the electron app but under the development conditions
** Expected results **
I expect it to find the records even if it is slower.

** This is sample code for performance test**

function performanceNeDBTest(){
    
    return new Promise((resolve,reject)=>{

      for (let i = 0; i < 1000000; i++) { // 1 million sale records being inserted      
        const newSale  = {
          prod_name: "PANGA STRAIGHT 18''",
          retail_price: 7000,
          costPrice: 5416,
          sales_qty: 3,
          who_sold: 'gerald',
          batchCode: null,
          customerId: 'TA2IEQW81ouTi07J',
          paymentOption: 'cash',
          depositAmount: 0,
          shopId: 'EB2I1OZYQHW',
          soldAt: new Date(),
          synced: false,
          closed: false
        }
          salesDB.insert(newSale, (err, newDoc)=>{
              console.log('Added sale record', i )
              if (i === (1000000-1) ) {
                  console.log("==================== DONE WITH BALLISTIC TEST ======>")
                  resolve("Completed the BALLISTIC NEDB SALES INSERTION")
              }
          })
        
      }

    })
  }

@yeya
Copy link

yeya commented Apr 15, 2022

Solved by @seald here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants