Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 3b3636f

Browse files
authored
Merge pull request #40 from Meteor-Community-Packages/migration/3.0
Migration for compatibility with Meteor 3.0
2 parents a9f7a84 + e15d172 commit 3b3636f

File tree

11 files changed

+3341
-2997
lines changed

11 files changed

+3341
-2997
lines changed

.github/workflows/testsuite.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: setup node
18-
uses: actions/setup-node@v3
18+
uses: actions/setup-node@v4
1919
with:
20-
node-version: 16
20+
node-version: 20
2121

2222
- name: cache dependencies
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
2525
path: ~/.npm
26-
key: ${{ runner.os }}-node-16-${{ hashFiles('**/package-lock.json') }}
26+
key: ${{ runner.os }}-node-20-${{ hashFiles('**/package-lock.json') }}
2727
restore-keys: |
28-
${{ runner.os }}-node-16-
28+
${{ runner.os }}-node-20-
2929
3030
- run: cd test-proxy && npm ci && npm run setup && npm run lint
3131

@@ -36,30 +36,28 @@ jobs:
3636
strategy:
3737
matrix:
3838
meteorRelease:
39-
- '2.3'
40-
- '2.8.0'
41-
- '2.14'
39+
- '3.0-rc.2'
4240
# Latest version
4341
steps:
4442
- name: Checkout code
45-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
4644

4745
- name: Install Node.js
48-
uses: actions/setup-node@v3
46+
uses: actions/setup-node@v4
4947
with:
50-
node-version: 16
48+
node-version: 20
5149

5250
- name: Setup meteor ${{ matrix.meteorRelease }}
5351
uses: meteorengineer/setup-meteor@v1
5452
with:
5553
meteor-release: ${{ matrix.meteorRelease }}
5654

5755
- name: cache dependencies
58-
uses: actions/cache@v3
56+
uses: actions/cache@v4
5957
with:
6058
path: ~/.npm
61-
key: ${{ runner.os }}-node-16-${{ hashFiles('**/package-lock.json') }}
59+
key: ${{ runner.os }}-node-20-${{ hashFiles('**/package-lock.json') }}
6260
restore-keys: |
63-
${{ runner.os }}-node-16-
61+
${{ runner.os }}-node-20-
6462
6563
- run: cd test-proxy && npm ci && npm run setup && npm run test

.versions

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
23-
24-
25-
26-
27-
28-
29-
local-test:dburles:[email protected]
30-
31-
32-
33-
meteortesting:[email protected]
34-
meteortesting:[email protected]
35-
meteortesting:[email protected]
36-
37-
38-
39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
55-
56-
57-
58-
59-
60-
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
local-test:dburles:[email protected]
31+
32+
33+
34+
meteortesting:[email protected]
35+
meteortesting:[email protected]
36+
meteortesting:[email protected]
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
[![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)
77
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
88

9+
This package augments Mongo.Collection (and the deprecated Meteor.Collection) and allows you to later lookup a Mongo Collection instance by the collection name.
910

11+
## Version 1.0.0 breaking changes!
1012

11-
This package augments Mongo.Collection (and the deprecated Meteor.Collection) and allows you to later lookup a Mongo Collection instance by the collection name.
13+
> Beginning with version 1.0.0, this packages requires Meteor >= 3.0
14+
15+
Apart from that, everything else remains the same.
1216

1317
## Installation
1418

mongo-instances.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* global CollectionExtensions */
21
import { Mongo } from 'meteor/mongo'
32
import { Meteor } from 'meteor/meteor'
3+
import { CollectionExtensions } from 'meteor/lai:collection-extensions'
44
const instances = []
55

6-
CollectionExtensions.addExtension(function (name, options) {
6+
CollectionExtensions.addExtension(function mongoCollectionInstances (collection, name, options) {
77
instances.push({
88
name: name,
9-
instance: this,
9+
instance: collection,
1010
options: options
1111
})
1212
})

mongo-instances.tests.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,35 @@ import { Meteor } from 'meteor/meteor'
77
const randomName = () => `test${Random.id(6)}`
88
const equal = (a, b) => expect(a).to.equal(b)
99

10+
const insert = (collection, doc) => Meteor.isClient
11+
? collection.insert(doc)
12+
: collection.insertAsync(doc)
13+
1014
describe('unit tests', () => {
1115
let collectionName
1216

1317
beforeEach(() => {
1418
collectionName = randomName() // random ID, so a new collection every time
1519
})
1620

17-
it('basic - works Mongo.Collection', () => {
21+
it('basic - works Mongo.Collection', async () => {
1822
const Test = new Mongo.Collection(collectionName)
1923

20-
Test.insert({ test: true })
24+
await insert(Test, { test: true })
2125
const find = Mongo.Collection.get(collectionName).find({ test: true })
22-
equal(find.count(), 1)
26+
equal(await find.countAsync(), 1)
2327

2428
// get an existing collection again
2529
const ReGet = Mongo.Collection.get(collectionName)
26-
equal(ReGet.find().count(), 1)
30+
equal(await ReGet.find().countAsync(), 1)
2731
})
2832

29-
it('basic - works Meteor.Collection', function () {
33+
it('basic - works Meteor.Collection', async () => {
3034
const Test = new Meteor.Collection(collectionName)
31-
Test.insert({ test: true })
35+
await insert(Test, { test: true })
3236

3337
const find = Meteor.Collection.get(collectionName).find({ test: true })
34-
equal(find.count(), 1)
38+
equal(await find.countAsync(), 1)
3539
})
3640

3741
it('basic - collection already exists', () => {

package.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@
22
Package.describe({
33
name: 'dburles:mongo-collection-instances',
44
summary: 'Access your Mongo instances',
5-
version: '0.4.0',
5+
version: '1.0.0',
66
git: 'https://github.com/dburles/mongo-collection-instances.git'
77
})
88

99
Package.onUse(function (api) {
10-
api.versionsFrom(['1.0', '2.3', '2.8.0'])
10+
api.versionsFrom(['2.3', '2.8.0', '3.0'])
1111
api.use([
12-
'mongo',
1312
'ecmascript',
14-
13+
'mongo',
14+
1515
api.addFiles('mongo-instances.js')
1616
})
1717

1818
Package.onTest(function (api) {
19+
api.versionsFrom(['2.3', '2.8.0', '3.0'])
1920
api.use([
2021
'ecmascript',
21-
'meteortesting:[email protected]',
2222
'accounts-base',
2323
'mongo',
24-
'dburles:mongo-collection-instances'
24+
'typescript',
25+
'meteortesting:[email protected]',
26+
2527
])
2628
api.addFiles('mongo-instances.tests.js')
2729
})

test-proxy/.meteor/packages

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
# 'meteor add' and 'meteor remove' will edit this file for you,
55
# but you can also edit it by hand.
66

7-
[email protected].1 # Packages every Meteor app needs to have
8-
[email protected].1 # Packages for a great mobile UX
9-
mongo@1.16.8 # The database Meteor supports right now
10-
[email protected].2 # Define static page content in .html files
11-
[email protected].12 # Reactive variable for tracker
12-
[email protected].3 # Meteor's client-side reactive programming library
7+
[email protected].2 # Packages every Meteor app needs to have
8+
[email protected].2 # Packages for a great mobile UX
9+
mongo@2.0.0 # The database Meteor supports right now
10+
[email protected].3 # Define static page content in .html files
11+
[email protected].13 # Reactive variable for tracker
12+
[email protected].4 # Meteor's client-side reactive programming library
1313

14-
[email protected] # CSS minifier run for production mode
15-
[email protected] # JS minifier run for production mode
16-
[email protected] # ECMAScript 5 compatibility for older browsers
17-
[email protected] # Enable ECMAScript2015+ syntax in app code
18-
[email protected] # Enable TypeScript syntax in .ts and .tsx modules
19-
[email protected] # Server-side component of the `meteor shell` command
14+
[email protected] # CSS minifier run for production mode
15+
[email protected] # JS minifier run for production mode
16+
[email protected] # ECMAScript 5 compatibility for older browsers
17+
[email protected] # Enable ECMAScript2015+ syntax in app code
18+
[email protected] # Enable TypeScript syntax in .ts and .tsx modules
19+
[email protected] # Server-side component of the `meteor shell` command
20+
21+

test-proxy/.meteor/release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
METEOR@2.14
1+
METEOR@3.0.1

0 commit comments

Comments
 (0)