angular2-meteor icon indicating copy to clipboard operation
angular2-meteor copied to clipboard

._ensureIndex(..) is no longer working, is there a new API for this?

Open cesargalindo opened this issue 10 years ago • 3 comments

._ensureIndex(..) is no longer working when declaring a collection using the MeteorObservable.

Example _ensureIndex call:

// Create Unique Index for CollectionX
import { CollectionX } from '../both/collections/collectionx.collection';
CollectionX._ensureIndex( { rpId: 1, spId: 1 }, { unique: true } );

Example Collection Declaration:

import { MongoObservable } from 'meteor-rxjs';
import { Meteor } from 'meteor/meteor';

import { Party } from '../models/party.model';

export const Parties = new MongoObservable.Collection<Party>('parties');

cesargalindo avatar Oct 11 '16 06:10 cesargalindo

I was able to get around this by connecting to the mongo db directly and calling the createindex() function

    let collection = db.collection('collectionx');
    collection.createIndex( { rpId: 1, spId: 1 }, { unique: true } );

cesargalindo avatar Oct 11 '16 11:10 cesargalindo

The API in this case is to create a collection, set an index, and then:

export const Parties = new MongoObservable.Collection<Party>(collection);

barbatus avatar Oct 11 '16 11:10 barbatus

Also please post issues related to meteor-rxjs to the associated repo.

barbatus avatar Oct 15 '16 12:10 barbatus