Giter VIP home page Giter VIP logo

minimongo's People

Contributors

broncha avatar cncolder avatar dallasvogels avatar grassick avatar mbriau avatar notslang avatar perlun avatar pubkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimongo's Issues

Does it support react native?

So the main problem in react native is to find the compatiable library to support offline+sync. Does it support react native?

Typings

Are there typings for minimongo ?

hybriddb usage?

I need a way to keep in sync the local indexeddb and the remote mongodb. I think I could use the HybridDB to get this working but I can't understand how does it work...

Could be possible have an usage example of this function?

High Vulnerability - Prototype Polution update to Lodash 4.17.11

                 === npm audit security report ===                        
                                                                            
                                                                            
                             Manual Review                                  
         Some vulnerabilities require your attention to resolve             
                                                                            
      Visit https://go.npm.me/audit-guide for additional guidance           

High Prototype Pollution

Package lodash

Patched in >=4.17.11

Dependency of minimongo

Path minimongo > lodash

More info https://nodesecurity.io/advisories/782

Low Prototype Pollution

Package lodash

Patched in >=4.17.5

Dependency of minimongo

Path minimongo > lodash

More info https://nodesecurity.io/advisories/577

found 2 vulnerabilities (1 low, 1 high) in 72 scanned packages
2 vulnerabilities require manual review. See the full report for details.

[Request] Make minimongo AMD Compatible

Hello,

I would like to request to make minimongo compatible with AMD since this is a separate package from meteor so it is better to have it as AMD module.

Also it let me handle dependencies much more elegent. For example, currently my company going to implement minimongo, but just the LocalStorage DB so it is better to have each module an AMD and we will manually include each module in our gulp build.

Some of the dependencies for minimongo are already available in our source code, and some other are used only by minimongo module like IndexDB, so it could be better to separate them to minimize unused javascript.

Much better and much more elegant.

Thank you!

Has anyone solved RemoteDB security problems?

I want to use Minimongo.

Exposing remoteURL and connectionID on the client seems to be a security problem.

So it's hard to use it as a security issue.

Has anyone solved RemoteDB security problems?

I want you to let me know if you have a good idea ...

remove() does not support a query

Remove is defined as remove(id, success, error), where as mongo defines remove(<query>, {opts}) ... so a query would be nice.

Hint: for anyone trying remove({}), do a .removeCollection() then recreate it. or with a filter (remove with query): thecollection.find({filter as usual}).fetch((rows)=>rows.map((row)=>thecollection.remove(row._id)))

Can this be MIT license?

I like the work on this, but the GPL license makes it harder to use with commercial projects. Meteor has an MIT license, which works much better for that.

Is there a reason this needs to be GPL or can it switch to Meteor's MIT with the new developers added on?

Sorting the collection locally

My business requirements specifies that my mongo docs should be displayed sorted and paged in a table, where their sort order ignores their case. Unfortunately, sorting while ignoring case, is not supported using the current Mongo publication interface.

So currently, my publication must request the complete collection, unsorted, and I must sort the docs locally, then determine which docs I can display for the page.

I am doing that. I copy the whole unsorted minimongo collection into a reactive array (using observe), then sort, then display the correct portion of that instead, and it works, but:

  • its unfortunately that I am required to publish the complete collection in order to determine which subset of docs to display. I only display 20 docs per page.
  • its also unfortunate that I lose the nice blaze feature that a single doc update only causes the matching displayed doc to be refreshed. Currently, because I am sorting using a reactive array, any displayed doc change causes all my displayed docs to be redisplayed.

Am I missing something? Is there any way I can hook into mongo/minimongo to specify my more specific publication request, and is there any way I can write something that supports blaze's singledoc display optimization, but when using arrays of docs instead of a collection?

As my number of docs in my collection increases, this is becoming more and more critical.

Any suggestions would be handy. THX

Promise version?

I just noticed when promisifying collection methods that the callback from functions such as "upsert" won't use the node.js callback standard of ( error, result ).

Is there a reason for this? How am supposed to handle errors?

Windows Phone chooses WebSQL which is not supported

 "user_agent": "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; 909) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"

bowser: {\"name\":\"Windows Phone\",\"windowsphone\":true,\"msie\":true,\"version\":\"11.0\",\"webkit\":true,\"android\":true,\"mobile\":true,\"a\":true}

Build tasks are racing

I am getting module not found errors from Browserify after cloning a fresh repo for development.

The (temporary) fix is:
Tasks need to be run individually (coffee > copy > dist), the 'default' task would allow the dist task to begin running before coffee & copy have completed.

Uganda debugging

Introduced in d3ddea6... not sure what it's for but it seems like it should have an issue associated with it.

setting up hybrid db

hi,

I have a database on a server and I'm trying to recreate what meteor does; a local db on the browser that syncs bi-directionally with the one on the server.
how do I set this up? I looked at the source code yet I'm unsure what to pass to the url, client and httpClient parameters for the remoteDb constructor. could you provide example code for this scenario? I'm unable to infer this just from reading the docs.

thanks

utils.autoselectLocalDb() requires an example

trying out how it works, I ended up with this:
var localDb; var useless_something = minimongo.utils.autoselectLocalDb({namespace: "myDb"}, function(localDb_init) { localDb = localDb_init; }, function() { alert("some error!"); });

[Bug] Occur 'transaction' of null at addCollection or removeCollection on IndexedDb backend

Possibly unhandled TypeError: Cannot read property 'transaction' of null
  at [object Object].IDBStore.iterate (/Users/mizchi/proj/kobito-shell/shell/node_modules/minimongo/node_modules/idb-wrapper/idbstore.js:1033:38)
  at [object Object].IDBStore.query (/Users/mizchi/proj/kobito-shell/shell/node_modules/minimongo/node_modules/idb-wrapper/idbstore.js:1093:19)
  at IndexedDb.module.exports.IndexedDb.removeCollection (/Users/mizchi/proj/kobito-shell/shell/node_modules/minimongo/lib/IndexedDb.js:60:23)

This log occurs at atom-shell envrironment but also occur at Chrome.

I tried 2 patterns but both failed. (sorry for coffeescript)

case 1

db = new minimongo.IndexedDb('testdb')
db.addCollection('a')
db.removeCollection('a')
db.addCollection('a')
db.a.find({})

case 2

db = new minimongo.IndexedDb('testdb')
db.addCollection 'a', ->
  db.removeCollection 'a', ->
    db.addCollection 'a', ->
      db.a.find {}

I added setTimeout before find so it works

db = new minimongo.IndexedDb('testdb')
db.addCollection('a')
db.removeCollection('a')
db.addCollection('a')
setTimeout ->
  db.a.find({})
, 100

I doubt minimongo lost correct callback of IndexedDb ready.

IOS WKWebView Spec Change

It looks like they have moved webkitIndexedDB to webkitIDBDatabase. Assuming I am reading your code right. There seems to be a factory pattern too. Not sure the proper way to use the object set yet.

This is reproducible when using the latest Cordova with this plugin.

IndexedDb can't see data written from previous session

This is in Chrome.

I have minimongo working great for reading/writing to a MemoryDb and writing to an IndexedDb. It can read from the IndexedDb while the current session is active. However, if I refresh the page, in the resources tab of the Chrome debugger I can see all of my data, but after the IndexedDb returns the handle to the database it has no collections. If I create a collection it still can't see the data that was previously written to the collection.

$(document).ready(function() {
new minimongo.IndexedDb({namespace : 'xxxxxx_data'}, function(success) {
indexedDb = success;
call_my_initialize_function_here
}, function(failure) {
});
});

Any thoughts about what I'm doing wrong? Thanks for a great library!

Find out why local dbs don't resolve differing upserts

Test is this:

    it "retains changed pending upserts", (done) ->
      @db.scratch.upsert { _id: 2, a: 'banana' }, =>
        @db.scratch.upsert { _id: 2, a: 'banana2' }, =>
          @db.scratch.resolveUpsert { _id: 2, a: 'banana' }, =>
            @db.scratch.pendingUpserts (results) =>
              assert.equal results.length, 1
              assert.equal results[0].a, 'banana2'
              done()

But HybridDb uploads as:

        @remoteCol.upsert(upsert, () =>
          @localCol.resolveUpsert upsert, =>
            uploadUpserts(_.rest(upserts), success, error)

which never exercises the code. Even if it did, why would a server change (probably from a merge) require retaining the upsert?

How update data locally??

I need update data locally, im using upsert function but the new data is saved in base and the old in doc...

        $rootScope.IndexedDb[database].findOne({_id: data['_id']}, {}, function (res) {
          if (res === null) {
            $rootScope.IndexedDb[database].upsert(data, function () { });
          }
          else {
            if (angular.equals(res, data) == false){
              $rootScope.IndexedDb[database].upsert(res, data, function (data_upserted) {
                console.log(data_upserted);
              });
            }
          }

});

in hybridDb, by default it fetch all fields from remoteDb and cache them. wish to change this behavior

in hybridDb code we see:

      # If caching, get all fields
      if options.cacheFind
        delete remoteOptions.fields

but sometimes we need to fetch a list from remoteDb, which has loooooooots of items but just includes _id and name fields. we need to cache it, so cacheFind option has to be true. But we don't need the other fields. actually the other fields might be very huge and it's impossible to fetch logs of items all at once.

@grassick would you please consider change this behavior, or at least give a new option to turn this off?

remove jquery dependency

since remoteDB support customized httpclient, is it possible to remove the must dependency on jquery, and require jquery only when there's no customized httpclient?

collection.remove() not removing from IndexedDB

Hi,

Sorry if this isn't a code issue but I'm a bit stuck.

I'm having an issue with removing doc(s) from a database backed by IndexedDB. I've noticed that minimongo is setting the 'state' property to 'removed' in the database, it's not actually being removed.

Thanks in advance!

replication MONGODB

Hello,
Today I have in the backend an application with mongoDB and I'm building my frontend in PWA, how can I use in frontend the minimongo with synchronization, for my MongoDb backend database?

Support for update operators

Do you currently support any update operators, such as $inc, $push, $mul, etc. and is there a plan to support them?

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.