-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from Meteor-Community-Packages/meteor-3
Meteor 3.0 migration
- Loading branch information
Showing
29 changed files
with
5,010 additions
and
3,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* | ||
|
||
- [4.0.0-beta.5](#400-beta.3) | ||
- [3.5.0](#350) | ||
- [3.4.1](#341) | ||
- [3.4.0](#340) | ||
|
@@ -77,6 +78,17 @@ | |
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
## 4.0.0 | ||
|
||
- Make collection2 compatible with Meteor 3.0 thanks to the [awesome work](https://github.com/Meteor-Community-Packages/meteor-collection2/pull/443) by @klablink | ||
- Remove clean options https://github.com/Meteor-Community-Packages/meteor-collection2/pull/436 | ||
- Prettier is added to enforce a consistent style across the project | ||
- Removed `babel-polyfill` | ||
- Updated expect to `26.6.2` | ||
- Use [`aldeed:[email protected]`](https://github.com/Meteor-Community-Packages/meteor-simple-schema/releases/tag/v1.13.1) instead of [NPM version](https://github.com/longshotlabs/simpl-schema). | ||
- Add static & dynamic loading | ||
- Fix error with quave:synced-cron | ||
|
||
## 3.5.0 | ||
|
||
Add the ability to override in-built schema clean options. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ This package requires the [simpl-schema](https://github.com/aldeed/simple-schema | |
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
|
||
- [Installation](#installation) | ||
- [Import using static imports](#import-using-static-imports) | ||
- [Import using dynamic imports](#import-using-dynamic-imports) | ||
- [Why Use Collection2](#why-use-collection2) | ||
- [Attaching a Schema to a Collection](#attaching-a-schema-to-a-collection) | ||
- [Attaching Multiple Schemas to the Same Collection](#attaching-multiple-schemas-to-the-same-collection) | ||
|
@@ -59,11 +61,40 @@ This package requires the [simpl-schema](https://github.com/aldeed/simple-schema | |
|
||
In your Meteor app directory, enter: | ||
|
||
### 4.0 | ||
|
||
Starting 4.0 collection2 ships with built in [`aldeed:[email protected]`](https://github.com/Meteor-Community-Packages/meteor-simple-schema/releases/tag/v1.13.1). | ||
|
||
```bash | ||
meteor add aldeed:collection2 | ||
``` | ||
|
||
### 3.x | ||
|
||
```bash | ||
meteor add aldeed:collection2 | ||
meteor npm install --save simpl-schema | ||
meteor npm install --save [email protected] | ||
``` | ||
|
||
## Import using static imports | ||
|
||
If you come from a previous version and want to "keep things as they were" then this is the option you should choose. | ||
|
||
```js | ||
import 'meteor/aldeed:collection2/static'; | ||
``` | ||
|
||
## Import using dynamic imports | ||
|
||
Dynamic imports helps to cut down on bundle size but it requires you to manually load the package for things to work. | ||
|
||
```js | ||
import 'meteor/aldeed:collection2/dynamic'; | ||
|
||
Collection2.load(); | ||
``` | ||
|
||
|
||
## Why Use Collection2 | ||
|
||
- While adding allow/deny rules ensures that only authorized users can edit a document from the client, adding a schema ensures that only acceptable properties and values can be set within that document from the client. Thus, client side inserts and updates can be allowed without compromising security or data integrity. | ||
|
@@ -361,26 +392,6 @@ instance for a Mongo.Collection instance. For example: | |
MyCollection.simpleSchema().validate(doc); | ||
``` | ||
|
||
## Schema Clean Options | ||
|
||
You can set the simpl-schema clean options globally in collection2. They are merged with any options defined on the schema level. | ||
|
||
```js | ||
import Collection2 from 'meteor/aldeed:collection2' | ||
|
||
// The values shown are the default options used internally. Overwrite them if needed. | ||
Collection2.cleanOptions = { | ||
filter: true, | ||
autoConvert: true, | ||
removeEmptyStrings: true, | ||
trimStrings: true, | ||
removeNullsFromArrays: true, | ||
} | ||
|
||
// Or you can update individual options. | ||
Collection2.cleanOptions.filter = false; | ||
``` | ||
|
||
## Passing Options | ||
|
||
In Meteor, the `update` function accepts an options argument. Collection2 changes the `insert` function signature to also accept options in the same way, as an optional second argument. Whenever this documentation says to "use X option", it's referring to this options argument. For example: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "meteor-collection2", | ||
"version": "1.0.0", | ||
"description": "[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) ![GitHub](https://img.shields.io/github/license/Meteor-Community-Packages/meteor-collection2) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Meteor-Community-Packages/meteor-collection2.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Meteor-Community-Packages/meteor-collection2/context:javascript) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Meteor-Community-Packages/meteor-collection2?label=latest&sort=semver) [![](https://img.shields.io/badge/semver-2.0.0-success)](http://semver.org/spec/v2.0.0.html) ![Test suite](https://github.com/Meteor-Community-Packages/meteor-collection2/workflows/Test%20suite/badge.svg)", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Meteor-Community-Packages/meteor-collection2.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/Meteor-Community-Packages/meteor-collection2/issues" | ||
}, | ||
"homepage": "https://github.com/Meteor-Community-Packages/meteor-collection2#readme", | ||
"devDependencies": { | ||
"prettier": "3.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.