Last active
April 3, 2019 07:28
-
-
Save bangbang93/925fad7317c7f09ea4edae57da2d3a3e to your computer and use it in GitHub Desktop.
mongoose-issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose') | |
mongoose.connect('mongodb://localhost/test') | |
const schema = new mongoose.Schema({}, {strict: false}) | |
const model = mongoose.model('test', schema) | |
model.collection.indexExists('users.user_1', (err, res) => { | |
console.log(err, res) | |
if (res) return model.collection.dropIndex('users.user_1') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose') | |
mongoose.connect('mongodb://localhost/test') | |
const schema = new mongoose.Schema({}, {strict: false}) | |
const model = mongoose.model('test', schema) | |
model.collection.indexExists('users.user_1') | |
.then(async (res) => { | |
if (res) return model.collection.dropIndex('users.user_1') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment