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 @@
accounts-base@2.2.9
accounts-base@2.2.10
allow-deny@1.1.1
babel-compiler@7.10.5
babel-runtime@1.5.1
Expand All @@ -7,7 +7,7 @@ binary-heap@1.0.11
boilerplate-generator@1.7.2
callback-hook@1.5.1
check@1.3.2
dburles:mongo-collection-instances@0.4.0
dburles:mongo-collection-instances@1.0.0-beta300.2
ddp@1.4.1
ddp-client@2.6.1
ddp-common@1.4.0
Expand All @@ -22,17 +22,17 @@ ecmascript-runtime-server@0.11.0
ejson@1.1.3
fetch@0.1.4
geojson-utils@1.0.11
http@1.0.10
http@1.0.1
id-map@1.1.1
inter-process-messaging@0.1.1
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
localstorage@1.2.0
logging@1.3.3
meteor@1.11.4
meteortesting:browser-tests@1.3.5
meteortesting:mocha@2.0.0
meteortesting:mocha-core@7.0.1
meteor@1.11.5
meteortesting:browser-tests@1.6.0-beta300.0
meteortesting:mocha@3.1.0-beta300.0
meteortesting:mocha-core@8.3.1-beta300.0
minimongo@1.9.3
modern-browsers@0.1.10
modules@0.20.0
Expand All @@ -54,7 +54,7 @@ routepolicy@1.1.1
socket-stream-client@0.5.2
tracker@1.3.3
typescript@4.9.5
underscore@1.0.13
underscore@1.6.0
url@1.3.2
webapp@1.13.6
webapp@1.13.8
webapp-hashing@1.1.1
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:collection-extensions@0.4.0'])
'mongo',
'lai:collection-extensions@1.0.0-beta300.2'])
api.addFiles('mongo-instances.js')
})

Package.onTest(function (api) {
api.use([
'ecmascript',
'meteortesting:mocha@2.0.0',
'accounts-base',
'mongo',
'dburles:mongo-collection-instances'
'meteortesting:mocha@3.1.0-beta300.0',
'dburles:mongo-collection-instances@1.0.0-beta300.2'
])
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.

meteor-base@1.5.1 # Packages every Meteor app needs to have
mobile-experience@1.1.1 # Packages for a great mobile UX
mongo@1.16.8 # The database Meteor supports right now
static-html@1.3.2 # Define static page content in .html files
reactive-var@1.0.12 # Reactive variable for tracker
tracker@1.3.3 # Meteor's client-side reactive programming library

standard-minifier-css@1.9.2 # CSS minifier run for production mode
standard-minifier-js@2.8.1 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.16.8 # Enable ECMAScript2015+ syntax in app code
typescript@4.9.5 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command

lai:collection-extensions@1.0.0-beta300.2
dburles:mongo-collection-instances@1.0.0-beta300.2
meteortesting:mocha@3.1.0-beta300.0
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 @@
METEOR@2.15
70 changes: 70 additions & 0 deletions test-proxy-2x/.meteor/versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
allow-deny@1.1.1
autoupdate@1.8.0
babel-compiler@7.10.5
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
blaze-tools@1.1.3
boilerplate-generator@1.7.2
caching-compiler@1.2.2
caching-html-compiler@1.2.1
callback-hook@1.5.1
check@1.3.2
dburles:mongo-collection-instances@1.0.0-beta300.1
ddp@1.4.1
ddp-client@2.6.1
ddp-common@1.4.0
ddp-server@2.7.0
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.8
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.3
es5-shim@4.8.0
fetch@0.1.4
geojson-utils@1.0.11
hot-code-push@1.0.4
html-tools@1.1.3
htmljs@1.1.1
id-map@1.1.1
inter-process-messaging@0.1.1
lai:collection-extensions@1.0.0-beta300.1
launch-screen@2.0.0
logging@1.3.3
meteor@1.11.5
meteor-base@1.5.1
minifier-css@1.6.4
minifier-js@2.7.5
minimongo@1.9.3
mobile-experience@1.1.1
mobile-status-bar@1.1.0
modern-browsers@0.1.10
modules@0.20.0
modules-runtime@0.13.1
mongo@1.16.9
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
npm-mongo@4.17.2
ordered-dict@1.1.0
promise@0.12.2
random@1.2.1
react-fast-refresh@0.2.8
reactive-var@1.0.12
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
shell-server@0.5.0
socket-stream-client@0.5.2
spacebars-compiler@1.3.1
standard-minifier-css@1.9.2
standard-minifier-js@2.8.1
static-html@1.3.2
templating-tools@1.2.2
tracker@1.3.3
typescript@4.9.5
underscore@1.6.1
webapp@1.13.8
webapp-hashing@1.1.1
Loading
Loading