Skip to content
Discussion options

You must be logged in to vote
{ autoCreate: false, autoIndex: false, autoSearchIndex: false, collection: 'contents' }

Also double check with a drop statement if found.

const existing = await db.listCollections({ name: 'contents' }, { nameOnly: true }).toArray();
  if (existing.length > 0) {
    try {
      log.info(`View contents was found. Attempting to drop it and create it with the latest pipeline.`);
      const dropCollectionResult = await mongoose.connection.dropCollection(ContentsReadViewName);
      log.info(`View contents dropped with result`, dropCollectionResult);
    } catch (error) {
      // Handle other potential errors
      log.error(error, `Error bootstrapping: dropping view/collection: ${ error.message

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@franky-continu
Comment options

@franky-continu
Comment options

Comment options

You must be logged in to vote
3 replies
@hasezoey
Comment options

@franky-continu
Comment options

@franky-continu
Comment options

Answer selected by hasezoey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #966 on February 12, 2026 11:56.