Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration for compatibility with Meteor 3.0 #40

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9af7ebe
build: prepare versions for Meteor 3.0
jankapunkt Jan 4, 2024
7856819
tests: upgraded test project and code to Meteor 3.0
jankapunkt Jan 5, 2024
348bf5c
fix: import lai:collection-extensions as module
jankapunkt Jan 8, 2024
3477780
published 1.0.0-beta300.0
jankapunkt Jan 8, 2024
a793678
docs: add breaking change note
jankapunkt Jan 8, 2024
b839d25
tests: update deps
jankapunkt Jan 8, 2024
0154487
fix: lint fix
jankapunkt Jan 9, 2024
fe522ee
tests: add own test project for Meteor 2.x compatibility
jankapunkt Jan 15, 2024
4d55a2e
build: Meteor 2.x backwards compatibility
jankapunkt Jan 15, 2024
d65ca0a
published 1.0.0-beta300.1 (3x + 2.x support)
jankapunkt Jan 15, 2024
486a6cb
fix: tests versions updated
jankapunkt Apr 15, 2024
9dfa67d
fix(build): no explicit versions for core package dependencies
jankapunkt Apr 15, 2024
0ab461f
release 1.0.0-beta300.2
jankapunkt Apr 15, 2024
5dc0219
tests: upgrade to 3.0-rc.2
jankapunkt Jun 11, 2024
a937534
ci: upgrade versions and node
jankapunkt Jun 11, 2024
a7437db
tests: upgrade to 3.0 rc.4
jankapunkt Jun 14, 2024
c65670a
published 1.0.0-rc300.1
jankapunkt Jun 14, 2024
228a6d9
tests: upgrade test project to 3.0.1
jankapunkt Aug 19, 2024
b21c22f
tests: remove 2x test-proxy
jankapunkt Aug 19, 2024
f2495b2
build: add 2.3 to api.versionsFrom
jankapunkt Aug 19, 2024
387a204
Merge branch 'master' of github.com:Meteor-Community-Packages/mongo-c…
jankapunkt Aug 21, 2024
c3e1426
tests: update test-deps
jankapunkt Aug 21, 2024
e15d172
publish 1.0.0
jankapunkt Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[email protected].9
[email protected].10
[email protected]
[email protected]
[email protected]
Expand All @@ -7,7 +7,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
dburles:mongo-collection-instances@0.4.0
dburles:mongo-collection-instances@1.0.0-beta300.2
[email protected]
[email protected]
[email protected]
Expand All @@ -22,17 +22,17 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].10
[email protected].1
[email protected]
[email protected]
lai:collection-extensions@0.4.0
local-test:dburles:mongo-collection-instances@0.4.0
lai:collection-extensions@1.0.0-beta300.2
local-test:dburles:mongo-collection-instances@1.0.0-beta300.2
[email protected]
[email protected]
[email protected].4
meteortesting:browser-tests@1.3.5
meteortesting:mocha@2.0.0
meteortesting:mocha-core@7.0.1
[email protected].5
meteortesting:browser-tests@1.6.0-beta300.0
meteortesting:mocha@3.1.0-beta300.0
meteortesting:mocha-core@8.3.1-beta300.0
[email protected]
[email protected]
[email protected]
Expand All @@ -54,7 +54,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
underscore@1.0.13
underscore@1.6.0
[email protected]
[email protected].6
[email protected].8
[email protected]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
[![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)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

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

## Version 1.0.0 breaking changes!

This package augments Mongo.Collection (and the deprecated Meteor.Collection) and allows you to later lookup a Mongo Collection instance by the collection name.
> Beginning with version 1.0.0, this packages requires Meteor >= 3.0

Apart from that, everything else remains the same.

## Installation

Expand Down
6 changes: 3 additions & 3 deletions mongo-instances.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* global CollectionExtensions */
import { Mongo } from 'meteor/mongo'
import { Meteor } from 'meteor/meteor'
import { CollectionExtensions } from 'meteor/lai:collection-extensions'
const instances = []

CollectionExtensions.addExtension(function (name, options) {
CollectionExtensions.addExtension(function mongoCollectionInstances (collection, name, options) {
instances.push({
name: name,
instance: this,
instance: collection,
options: options
})
})
Expand Down
18 changes: 11 additions & 7 deletions mongo-instances.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@ import { Meteor } from 'meteor/meteor'
const randomName = () => `test${Random.id(6)}`
const equal = (a, b) => expect(a).to.equal(b)

const insert = (collection, doc) => Meteor.isClient
? collection.insert(doc)
: collection.insertAsync(doc)

describe('unit tests', () => {
let collectionName

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

it('basic - works Mongo.Collection', () => {
it('basic - works Mongo.Collection', async () => {
const Test = new Mongo.Collection(collectionName)

Test.insert({ test: true })
await insert(Test, { test: true })
const find = Mongo.Collection.get(collectionName).find({ test: true })
equal(find.count(), 1)
equal(await find.countAsync(), 1)

// get an existing collection again
const ReGet = Mongo.Collection.get(collectionName)
equal(ReGet.find().count(), 1)
equal(await ReGet.find().countAsync(), 1)
})

it('basic - works Meteor.Collection', function () {
it('basic - works Meteor.Collection', async () => {
const Test = new Meteor.Collection(collectionName)
Test.insert({ test: true })
await insert(Test, { test: true })

const find = Meteor.Collection.get(collectionName).find({ test: true })
equal(find.count(), 1)
equal(await find.countAsync(), 1)
})

it('basic - collection already exists', () => {
Expand Down
12 changes: 6 additions & 6 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
Package.describe({
name: 'dburles:mongo-collection-instances',
summary: 'Access your Mongo instances',
version: '0.4.0',
version: '1.0.0-beta300.2',
git: 'https://github.com/dburles/mongo-collection-instances.git'
})

Package.onUse(function (api) {
api.versionsFrom(['1.0', '2.3', '2.8.0'])
api.versionsFrom(['2.3', '3.0-beta.0'])
api.use([
'mongo',
'ecmascript',
'lai:[email protected]'])
'mongo',
'lai:[email protected]'])
api.addFiles('mongo-instances.js')
})

Package.onTest(function (api) {
api.use([
'ecmascript',
'meteortesting:[email protected]',
'accounts-base',
'mongo',
'dburles:mongo-collection-instances'
'meteortesting:[email protected]',
'dburles:[email protected]'
])
api.addFiles('mongo-instances.tests.js')
})
1 change: 1 addition & 0 deletions test-proxy-2x/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
19 changes: 19 additions & 0 deletions test-proxy-2x/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package
1.7-split-underscore-from-meteor-base
1.8.3-split-jquery-from-blaze
1 change: 1 addition & 0 deletions test-proxy-2x/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions test-proxy-2x/.meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

d0r7an81o8kin.vtm8cy3h9d9
23 changes: 23 additions & 0 deletions test-proxy-2x/.meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected] # The database Meteor supports right now
[email protected] # Define static page content in .html files
[email protected] # Reactive variable for tracker
[email protected] # Meteor's client-side reactive programming library

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

lai:[email protected]
dburles:[email protected]
meteortesting:[email protected]
2 changes: 2 additions & 0 deletions test-proxy-2x/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server
browser
1 change: 1 addition & 0 deletions test-proxy-2x/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
70 changes: 70 additions & 0 deletions test-proxy-2x/.meteor/versions
Loading
Loading