Skip to content

TypeError: templateInstance.collection.findOne is not a function. -- With Meteor, fairly basic implementation using <divs> with form elements inside #768

Closed
@screaser

Description

@screaser

Using Meteor I implemented a pretty basic rubaxa:sortable instance. Not using multiple sortable lists or anything fancy. Pre-loaded "order" data in my Mongo Collection with unique numbers 1, 2, 3, etc.

Everything displays fine, and lets you sort once then the package dies when it tries to save the new order to the DB.

Error in the browser console is:
TypeError: templateInstance.collection.findOne is not a function. (In 'templateInstance.collection.findOne(itemId)', 'templateInstance.collection.findOne' is undefined) adjustOrdersrubaxa_sortable.js:1404 sortableUpdaterubaxa_sortable.js:1446 _dispatchEventrubaxa_sortable.js:1102 _onDroprubaxa_sortable.js:799 (anonymous function) handleEventrubaxa_sortable.js:853

Relevant code snippets below...

Server:
Products = new Mongo.Collection('products'); Sortable.collections = ['products'];

Client:
<div class="sortable target" id="object"> {{#sortable items=products animation="100" handle=".sortable-handle" ghostClass="sortable-ghost" sortField="order"}} {{> productSettingsRow}} {{/sortable}} </div>

`

...
...
`

Tried searching the Issues; don't see anything quite like this though #578 seems similar(?). Also didn't see a way to recreate in the JS scratchpad as requested since it has to do with DB access...

Any suggestions, or any other info I can provide to help debug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions