GithubHelp home page GithubHelp logo

meteor-community-packages / meteor-collection-extensions Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 14.0 365 KB

Safely and easily extend the (Meteor/Mongo).Collection constructor with custom functionality.

Home Page: https://packosphere.com/lai/collection-extensions

License: MIT License

JavaScript 95.84% CoffeeScript 4.16%
collection hacktoberfest meteorjs mongo mongodb

meteor-collection-extensions's People

Contributors

dependabot[bot] avatar jankapunkt avatar rclai avatar simonsimcity avatar storytellercz 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

Watchers

 avatar  avatar  avatar  avatar

meteor-collection-extensions's Issues

Using CollectionExtensions instead of Meteor?

How about using your own CollectionExtensions "namespace" instead of meteor's Meteor "namespace".

They've advised against using their namespace to prevent future collisions of functionality.

CollectionExtensions.addExtension and CollectionExtensions.addPrototype would be nice.

I'm gonna look into using this package for my zimme:collection-behaviours which is a re-write of sewdn:collection-behaviours package. I've added configuration and a couple of other things and it's used by zimme:collection-timestampable and zimme:collection-softremovable, which have support for aldeed:autoform, aldeed:collection2 and aldeed:simple-schema.

I'm thinking I can use this package for automagically adding the behaviours of the packages to collections.
I just need to figure out a good way to make it respect a user configurable exception list.

This is needed because for now you may only attach a behaviour and not detach it. And even if you wanna have all your collections by default use one of the behaviours you still might not want it on a specific collection.

`Meteor.addCollectionExtension` is deprecated

Ran meteor update a couple days ago and began getting this console warning message.

Meteor.addCollectionExtension is deprecated, please use CollectionExtensions.addExtension

How to fix?

Update README on mongo-collection-instances

I will fork major packages like matb33:collection-hooks, sewdn:collection-behaviours, dburles:mongo-collection-instances, refactor the code to use this utility package

This was already done (thanks, BTW!)

meteor 1.6.1 ?

TypeError: Class constructor Collection cannot be invoked without 'new'
W20171223-20:42:43.835(8)? (STDERR) at new ns.Collection (packages/lai_collection-extensions.js:107:27)
W20171223-20:42:43.835(8)? (STDERR) at autoupdate_server.js (packages/autoupdate/autoupdate_server.js:39:18)
W20171223-20:42:43.836(8)? (STDERR) at fileEvaluate (packages/modules-runtime.js:343:9)
W20171223-20:42:43.836(8)? (STDERR) at require (packages/modules-runtime.js:238:16)
W20171223-20:42:43.836(8)? (STDERR) at /Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/packages/autoupdate.js:226:1
W20171223-20:42:43.836(8)? (STDERR) at /Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/packages/autoupdate.js:233:3
W20171223-20:42:43.836(8)? (STDERR) at infos.forEach.info (/Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/boot.js:415:13)
W20171223-20:42:43.836(8)? (STDERR) at Array.forEach ()
W20171223-20:42:43.837(8)? (STDERR) at /Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/boot.js:414:9
W20171223-20:42:43.837(8)? (STDERR) at /Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/boot.js:468:5
W20171223-20:42:43.837(8)? (STDERR) at Function.run (/Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/profile.js:510:12)
W20171223-20:42:43.837(8)? (STDERR) at /Users/monsterstep/dev/meteor-react-router-test/.meteor/local/build/programs/server/boot.js:467:11

Meteor.Collection !== Meteor.Collection.prototype.constructor

After loading this package, the Meteor.Collection object is left halfway between the old state and the extended state. Any package that extends the patched Meteor.Collection using prototype inheritance, such as using Coffeescript class / extends will fail to use the monkey-patched constructor.

Here's the issue where I discovered this: vsivsi/meteor-file-sample-app#2 (comment)

I'm not embarrassed to say that I'm pretty opinionated about this, and I'm going to add more sanity checks and throws to my packages to defend against other packages that misbehave when replacing Meteor provided standard system calls.

IMO, the safe and sane way to extend Mongo.Collection is via a mechanism that supports, e.g.:

extendedCollection = collectionExtend(Mongo.Collection, methods);
collection = new extendedCollection('foo');
extraExtendedCollection = collectionExtend(extendedCollection, methods);
collection2 = new extraExtendedCollection('bar');

If the app developer wants the "convenience" of setting Mongo.Collection = extraExtendedCollection then let that be their choice.

Direct collection access

@matb33 said in Meteor-Community-Packages/meteor-collection-hooks#118:

I am, although there's one more thing I think your end needs to handle, which is direct collection access. I'd like to still offer users a way to circumvent collection hooks while still allowing other collection extensions, but it would be great to also offer the option for users to circumvent all collection extensions at once.

Updating dependencies

Hi @rclai we had a major update on the Meteor Accounts system and there are quite a few packages. Would you mind reviewing #16 ?

Extend Ground.Collection

First off, thanks for this great package!

It would be great if it could also extend ground:db collections, which are pretty useful when building offline/mobile apps.

zimme:collection-behaviours

I'm not currently using your package, but I intend to in the future. Real nice work and definitely needed.

I just ran into another collection-behaviors, apparently quickly gaining traction. Realized it was a different one than the one you had on your list and thought you might want it on your TODO list, at the very least. I think the zimme package has autoform support which might be the upper hand for it right now.

Anyway, just an FYI ticket. :)

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.