mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
_createIndex for collections
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
* `email@2.1.1`
|
||||
- Updated `nodemailer` to v6.6.3
|
||||
|
||||
* `mongo@1.12.1`
|
||||
- Add `_createIndex` as a collection function. This is a new name for `_ensureIndex` which MongoDB has deprecated and removed in MongoDB 5.0.
|
||||
|
||||
## v2.3.2, 2021-07-13
|
||||
|
||||
#### Meteor Version Release
|
||||
|
||||
@@ -674,6 +674,13 @@ Object.assign(Mongo.Collection.prototype, {
|
||||
self._collection._ensureIndex(index, options);
|
||||
},
|
||||
|
||||
_createIndex(index, options) {
|
||||
var self = this;
|
||||
if (!self._collection._createIndex)
|
||||
throw new Error("Can only call _createIndex on server collections");
|
||||
self._collection._createIndex(index, options);
|
||||
},
|
||||
|
||||
_dropIndex(index) {
|
||||
var self = this;
|
||||
if (!self._collection._dropIndex)
|
||||
|
||||
@@ -829,7 +829,7 @@ MongoConnection.prototype.findOne = function (collection_name, selector,
|
||||
|
||||
// We'll actually design an index API later. For now, we just pass through to
|
||||
// Mongo's, but make it synchronous.
|
||||
MongoConnection.prototype._ensureIndex = function (collectionName, index,
|
||||
MongoConnection.prototype._createIndex = function (collectionName, index,
|
||||
options) {
|
||||
var self = this;
|
||||
|
||||
@@ -840,6 +840,9 @@ MongoConnection.prototype._ensureIndex = function (collectionName, index,
|
||||
var indexName = collection.ensureIndex(index, options, future.resolver());
|
||||
future.wait();
|
||||
};
|
||||
|
||||
MongoCollection.prototype._ensureIndex = MongoConnection.prototype._createIndex;
|
||||
|
||||
MongoConnection.prototype._dropIndex = function (collectionName, index) {
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ process.env.MONGO_OPLOG_URL && testAsyncMulti(
|
||||
var self = this;
|
||||
self.collectionName = Random.id();
|
||||
self.collection = new Mongo.Collection(self.collectionName);
|
||||
self.collection._ensureIndex({species: 1});
|
||||
self.collection._createIndex({species: 1});
|
||||
|
||||
// Fill collection with lots of irrelevant objects (red cats) and some
|
||||
// relevant ones (blue dogs).
|
||||
|
||||
@@ -4,14 +4,13 @@ MongoInternals.RemoteCollectionDriver = function (
|
||||
self.mongo = new MongoConnection(mongo_url, options);
|
||||
};
|
||||
|
||||
_.extend(MongoInternals.RemoteCollectionDriver.prototype, {
|
||||
Object.assign(MongoInternals.RemoteCollectionDriver.prototype, {
|
||||
open: function (name) {
|
||||
var self = this;
|
||||
var ret = {};
|
||||
_.each(
|
||||
['find', 'findOne', 'insert', 'update', 'upsert',
|
||||
'remove', '_ensureIndex', '_dropIndex', '_createCappedCollection',
|
||||
'dropCollection', 'rawCollection'],
|
||||
['find', 'findOne', 'insert', 'update', 'upsert',
|
||||
'remove', '_ensureIndex', '_createIndex', '_dropIndex', '_createCappedCollection',
|
||||
'dropCollection', 'rawCollection'].forEach(
|
||||
function (m) {
|
||||
ret[m] = _.bind(self.mongo[m], self.mongo, name);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user