Desperate : TypeError: collection.find is not a function

HI : I have been struggling with this error for a while. My app was working under Meteor 1.3 , then in 1.5 I am getting the TypeError message bellow. What am I doing wrong ?

W20170803-05:21:13.644(-7)? (STDERR) TypeError: PricePosition.find is not a function
W20170803-05:21:13.644(-7)? (STDERR) at server/main.js:37:24
W20170803-05:21:13.645(-7)? (STDERR) at Function.time (/Users/ta/Development/simple-todos/.meteor/local/build/programs/server/profile.js:309:28)
W20170803-05:21:13.645(-7)? (STDERR) at /Users/ta/Development/simple-todos/.meteor/local/build/programs/server/boot.js:347:13
W20170803-05:21:13.645(-7)? (STDERR) at /Users/ta/Development/simple-todos/.meteor/local/build/programs/server/boot.js:388:5
W20170803-05:21:13.646(-7)? (STDERR) at Function.run (/Users/ta/Development/simple-todos/.meteor/local/build/programs/server/profile.js:510:12)
W20170803-05:21:13.646(-7)? (STDERR) at /Users/ta/Development/simple-todos/.meteor/local/build/programs/server/boot.js:386:11
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

/import/api/tasks.js
import { Mongo } from ‘meteor/mongo’;
export const Tasks = new Mongo.Collection(‘tasks’);
export const PricePosition = new Mongo.Collection(‘price_positions’);

main.js

import ‘…/imports/api/tasks.js’;
import PricePosition from '…/imports/api/tasks.js’
import Purchased from ‘…/imports/api/tasks.js’;
import FlowerBatchList from ‘…/imports/api/tasks.js’;
if (Meteor.isServer) {
Meteor.sartup(() => {
var last_run_position ;
PricePosition.find ({},function(err,price_position) {
if (price_position) {
last_run_position = 0;
}
});

Then the rest of the code…

You should be using:

import { PricePosition } from '/imports/api/tasks.js';
import { Purchased } from '/imports/api/tasks.js';
import { FlowerBatchList } from '/imports/api/tasks.js';

Note, I’ve also made the location an absolute reference (... is not valid).

1 Like

Thank you Rob. That fixed it.

1 Like