Giter VIP home page Giter VIP logo

Comments (9)

YurySolovyov avatar YurySolovyov commented on July 23, 2024

maybe just {enable,disable}MongoEmulation() ?

from forerunnerdb.

Irrelon avatar Irrelon commented on July 23, 2024

@YuriSolovyov Not sure I follow... could you write the usage in code?

from forerunnerdb.

YurySolovyov avatar YurySolovyov commented on July 23, 2024

@Irrelon I mean instead of

fdb.mongoEmulation(true);

use

fdb.enableMongoEmulation()

or

fdb.disableMongoEmulation()

just to get rid of true/false flag.

from forerunnerdb.

Irrelon avatar Irrelon commented on July 23, 2024

@YuriSolovyov Ahh I see.

That approach is more terse but increases code size by adding 3 methods to the class instead of 1.

1: fdb.enableMongoEmulation()
2: fdb.disableMongoEmulation()
3: isEnabled = fdb.isMongoEmulationEnabled()

By using a dynamic getter / setter we reduce all these actions down to 1 method call:

1: fdb.mongoEmulation(true)
2: fdb.mongoEmulation(false)
3: isEnabled = fdb.mongoEmulation()

Dynamic getter/setter methods are used throughout ForerunnerDB and are also familiar to those using other libraries like jQuery which make extensive use of them as well.

from forerunnerdb.

YurySolovyov avatar YurySolovyov commented on July 23, 2024

ok, good point.

from forerunnerdb.

Irrelon avatar Irrelon commented on July 23, 2024

Dev branch now has mongoEmulation() method on fdb, db and collection instances. Find, update and remove all tested and working with dot notation-based queries. Can you guys give it a try and let me know your results?

from forerunnerdb.

kevteljeur avatar kevteljeur commented on July 23, 2024

I haven't implemented the ForerunnerDB in the project I'm working on (when I got involved in the previous issue thread I was comparing and this issue came up), so I can't check the behaviour to verify for you at this point (we moved on and implemented another library) - my apologies! However, this does make it a contender again once we do, which will be soon enough.

from forerunnerdb.

Irrelon avatar Irrelon commented on July 23, 2024

Out of interest what library did you go with?

from forerunnerdb.

kevteljeur avatar kevteljeur commented on July 23, 2024

I used NeDB (this part of the project is Node.js-based) as an in-memory cache. There's still a requirement for a browser storage component, and if we went with NeDB for that then that would still leave a requirement to abstract the browser storage; NeDB seems to be designed more as a fast, file-backed solution, although it will work in the browser too. We're not using LocalForage yet but it does seem to be the way to go, and obviously ForerunnerDB has that covered.

from forerunnerdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.