These are chat archives for Automattic/mongoose

Jan 2017
Oleg Sucharevich
Jan 04 2017 10:42
Hey, when i use dropindex the index is been recreated on the first call , any ideas ?
Paul "Joey" Clark
Jan 04 2017 10:43
@olsynt If you are talking about _id, that one is always indexed by default. Nothing you can do about it AFAIK.
Actually capped collections are not indexed, but they are … well capped, which might not be what you want!
Oleg Sucharevich
Jan 04 2017 11:11
Hi, @joeytwiddle , thank you!. I'm facing the issue with other index. I'v two models one is nested int other. The nested model has index on some property. The wrapper model also get the index and when i delete it , the index is back.
Oleg Sucharevich
Jan 04 2017 15:31
const http = require('http');
const mongoose = require('mongoose');
const express = require('express');
var app = express();
var server = http.createServer(app);
server.listen(process.env.PORT, null, function() {
  console.log('Express server listening on %d, in %s mode');
mongoose.connect(process.env.MONGO, () => {});
const Car = new mongoose.Schema({
  name: String,
  year: String
Car.index({'name': 1, 'year': 1}, {unique: true});
const CarModel = mongoose.model('Car', Car);
const Provider = new mongoose.Schema({
    name: String,
    car: CarModel.schema
const ProviderModel = mongoose.model('Provider', Provider);
const cars = [{
  name: 'Honda',
  year: '1988'
}, {
  name: 'Toyota',
  year: '2003'
mongoose.connection.collections['providers'].dropIndex('car.name_1_car.year_1', (err, status) => {
  console.log(err, status);
Anyone knows why the index is not been dropped ?