Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    richard rose
    @manEatingFish_twitter
    Thanks I will try that
    richard rose
    @manEatingFish_twitter
    status: {regex: /^((?!Complete).)*$/s} worked
    Ujjwal Gupta
    @ujjwalguptaofficial
    glad to know :).
    richard rose
    @manEatingFish_twitter
    Question about limit, skip and where.
    I have this query running against 3000 entries
    from: "Entity"
    skip: 0
    limit: 100
    order:
    by: "name"
    type: "asc"
    on scroll i load the next 100 entries by altering the skip
    this all works correctly and they are sorted alphabetically, however when I add a where clause;
    from: "Entity"
    skip: 0
    limit: 100
    order: {by: "name", type: "asc", idbSorting: true}
    where:
    searchterm: {like: "%and%"}
    each group of 100 results is only sorted within its self
    it appears that the 100 limit based on the skip is take from an unordered result from the where, and then subsequently ordered within its self
    richard rose
    @manEatingFish_twitter
    Is this correct behaviour fro IndexedDB? if so is there anything I can do to make the the where and order occur before the skip and limit is applied?
    Let me know if you can regenerate.
    akhilponnala
    @akhilponnala
    Hi guys,
    How can we use union.
    Ujjwal Gupta
    @ujjwalguptaofficial

    Hi @akhilponnala

    right now, jsstore doesn't support union. Please add an issue on jsstore github page.

    Thanks.

    akhilponnala
    @akhilponnala
    Hi @ujjwalguptaofficial
    Please help me in preparing alternate query to union.
    Thanks.
    Ujjwal Gupta
    @ujjwalguptaofficial
    ok sure, looking into this.
    Ujjwal Gupta
    @ujjwalguptaofficial
    @akhilponnala - added the union api. Have a look at - https://jsstore.net/tutorial/union/
    akhilponnala
    @akhilponnala
    Hi @ujjwalguptaofficial
    Thank you for your support.
    akhilponnala
    @akhilponnala
    Hi @ujjwalguptaofficial ,
    How can we implement MYSQL CASE function using jsstore.
    for example:
    SELECT CustomerName, City, Country
    FROM Customers
    ORDER BY
    (CASE
    WHEN City IS NULL THEN Country
    ELSE City
    END);
    Please suggest us on above if there is any altenative method using jsstore
    Hi @ujjwalguptaofficial ,
    please suggest on specifying the default values using jsstore in table creation
    Ujjwal Gupta
    @ujjwalguptaofficial

    Hi

    Jsstore doesn't have this functionality yet. Please add an issue on github. I will take it from there. Thanks.

    akhilponnala
    @akhilponnala
    Hi @ujjwalguptaofficial ,
    Thank you.
    I have added issue on github. Please help us on implementing above.
    Thank you.
    akhilponnala
    @akhilponnala
    Hi @ujjwalguptaofficial ,
    Can we use 'Case' funtionality with group by clause.
    Can we apply then value from results dynamically.
    For example :
    select count(*) as s_count,d3.des as des1,(CASE d.des WHEN 'Other' THEN e.v_other ELSE d.des END) as making ,(CASE d1.des WHEN 'Other' THEN e.v_other ELSE d1.des END) as desc ,(CASE d.des WHEN 'Other' THEN e.v_other ELSE d.des END) as maker ,(CASE d1.des WHEN 'Other' THEN e.v_other ELSE d1.des END) as module ,sign.opId as oper_id from val as e inner join drop as d on d.drop_id=e.v_make inner join drop as d1 on d1.drop_id=e.v_model inner join sign as s on s.sig_id=e.sig_id inner join drop as d3 on d3.drop_id=s.oper_id group by making, module,oper_id order by oper_id
    Please help us on implementing above.
    Thank you.
    Ujjwal Gupta
    @ujjwalguptaofficial
    ok looking into this
    Ghost
    @ghost~5e1340abd73408ce4fd5da17

    @ujjwalguptaofficial ,

    I am working on a progressive web application project.

    The main thread, inspection.js, starts a worker, inspectionworker.js, and detects when the user is offline or online. When online, the information a user submits is sent directly to the server. When offline, the data is sent to the web worker for storing in the local database until the user is back online. Once online again, the service worker is responsible for sending all the offline data to the server while the main thread is available for new inspections.

    This was working when establishing a connection to the database using the JsStoreWorker directly. But after broader testing, I found out it was only working in Firefox and Chrome on my Mac. It failed in Safari and on mobile devices, saying the JsStoreWorker could not be found.

    I thought this problem might be solved by including the JsStoreWorker.js as a script but not using it directly in creating the connection objects, but it's not working. As a test, when I try to add a record and I have not imported the JsStoreWorker.js, an error is thrown saying JsStoreWorker cannot be found. When I import the script and try to add a record, the add fails silently.

    Based on the behavior/problem being similar in both cases, I am wondering if perhaps I cannot use JsStore in a web worker?

    Thanks in advance for you help!!

    Marion PERRIER
    @hist0plasma_gitlab
    Hi !
    Is it possible to use JsStore without any installation to do for the user ? :)
    (also serverless)
    Ujjwal Gupta
    @ujjwalguptaofficial
    JsStore is a client side library which works on top of indexeddb , its not a service. I am not sure what you are asking but hope this helps you to understand.
    PWTycoon
    @PWTycoon
    Is multi-entry basically the equivalent of storing an array? If so, can I perform array operations on a column? (push, indexOf, ...)
    Ujjwal Gupta
    @ujjwalguptaofficial

    You can store array without multientry, but element inside array wont be indexed so not searchable.

    multiEntry allows you to search elements present inside an array.

    JsStore supports only push functionality for now , check here - https://jsstore.net/tutorial/update-with-operators/

    But you are free to use whatever operation you want to do on array by retrieving the value using select api.

    Mike Talbot
    @mike_talbot_twitter
    Hi, I see that the Github page is showing no support for Edge and IE11 - is that right or is it a temporary thing that has the tests failing?
    Ujjwal Gupta
    @ujjwalguptaofficial
    temporary things - some test cases failing due to es6 code or some config. I have linux so not able to see what's happening.
    Mike Talbot
    @mike_talbot_twitter
    Many thanks! Looking forward to working with JsStore then!
    adamsbc
    @adamsbc
    I keep getting this error. ReferenceError: JsStoreWorker is not defined. I'm using JsStore in node js

    const JsStore = require('jsstore');
    var dbName ='client_db';
    function getDbSchema() {
    var tblTest = {
    name: 'Test',
    columns: {
    id:{ primaryKey: true, autoIncrement: true },
    title: { notNull: false, dataType: "string" },
    description: { notNull: false, dataType: "string" },
    type : { notNull: false, dataType: "string" },
    path : { notNull: false, dataType: "string" },
    createdBy : { notNull: false, dataType: "number" },
    groupID : { notNull: false, dataType: "number" },
    },
    name: "Group",
    columns: {
    id:{primaryKey: true, autoIncrement: true },
    name: { notNull: false, dataType: "string" },
    }
    };

    var db = {
    name: client_db,
    tables: [tblTest]
    }
    return db;
    }

    var client_connection = new JsStore.Connection();
    async function initJsStore() {
    var database = getDbSchema();
    const isDbCreated = await client_connection.initDb(database);
    if(isDbCreated===true){
    console.log("db created");
    // here you can prefill database with some data
    }
    else {
    console.log("db opened");
    }
    }

    Ujjwal Gupta
    @ujjwalguptaofficial
    @adamsbc You gotta include jsstore worker file . Check out this example - https://github.com/ujjwalguptaofficial/jsstore-examples/tree/master/without_web_worker
    adamsbc
    @adamsbc
    I have the Jsstore.worker.js in the same directory
    Ujjwal Gupta
    @ujjwalguptaofficial
    @adamsbc you need to include the script in your html file.
    adlf
    @adlf

    Hello. I'm getting this error.

    ReferenceError: JsStoreWorker is not defined

    On the top of my script, i'm importing jsstore like so

    import * as JsStore from 'jsstore';

    But as I understand this uses JsStoreWorker which is not defined in the module and since it can't find it it throws an error.

    I tried yarn add JsStoreWorker but no luck

    Stanislaw Grin
    @stanislav-grin

    Hi,
    faced an issue when doing select with 'not equal' condition ('!='). Seems like where clause is mutated when specify not equal condition and been replaced by '>'. Here is snippet that reproduces it for me:

        const where = { bio: { '!=': '' } }
    
        console.log('where: ', JSON.stringify(where)) // where:  {"bio":{"!=":""}}
    
        const records = await idbConnection.select({
          from: tableName,
          where
        })
    
        console.log('where: ', JSON.stringify(where)) // where:  {"bio":{">":""}}

    As you can see, there is no modifications of 'where' object from my side, but I constantly getting this result: '!=' is replaced by '>'.
    Any help/ideas would be much appreciated. Thanks!

    Ujjwal Gupta
    @ujjwalguptaofficial
    @stanislav-grin yes it is mutated to '>' or '<' query for faster data fetching using indexes. Do you see any problem with it ?
    Stanislaw Grin
    @stanislav-grin
    Yes, I have one of three objects with bio: null and receive only one object with bio that is not empty. SQL alternative would be 'where bio is not null'.
    And if I have 4 objects with 'age' column, values are 25, 27, 29, 30 select where age != 27 then I receiving only those objects where age > 27. Morover, (just checked it once again) - only one object is received (expected 3).
    Stanislaw Grin
    @stanislav-grin
    yes, in idbStudio it works as excepted, but not when running locally on my machine. I use latest version which is 3.7.3
    Could it be that idbStudio uses older version or something else that might affect on this?
    Ujjwal Gupta
    @ujjwalguptaofficial

    Can't say really what's happening, i just updated idbstudio with latest version of jsstore & it worked well.

    i will suggest you to check with different version of query like using regex , using or query with less than & greater than - and compare results. Use Idbstudio for debugging query.

    Stanislaw Grin
    @stanislav-grin
    I tried all other approachs (including regex, gt, ls, etc) and it works well.
    Ok, thanks. Then I'll try to create a small reproducible sample project today (in a couple of hours) and let you know it, if this behavior still persists, I'll share it with you. Thanks once again.
    Stanislaw Grin
    @stanislav-grin
    Seems column with primary key is required to be present for this to work correctly, does not it?
    Ujjwal Gupta
    @ujjwalguptaofficial
    yes, otherwise its not possible to compare different rows of records, Primary key is used to determine uniqueness of a row.