Add database to default collection window template

zcoss shared this idea 5 years ago
Completed

It would be great to be able to include the database in the Modify Default Code options to prevent mixups when performing operations. We have many databases on a single connection and sometimes have the issue where either:

  1. Accidentally perform a create operation on the active database, instead of the one we meant to.
  2. Accidentally perform an unsuccessful query on the active database, instead of the one we meant to.

For instance: db.getSiblingDB(%%database%%).%%collection%%.find({$1})

It would also be great to have an option in the lookahead feature where it would pre-fill the database instead of moving the cursor to inside the parenthesis when typing db.getSiblingDB into the shell.

Replies (3)

photo
1

We have worked out new build(4.7.4) to add %%database%% to code template. Please download and give it a try.

https://nosqlbooster.com/downloads

photo
1

I also noticed that you added the lookahead for databases into db.getSiblingDB() from the shell! Thanks so much!

photo
1

This also works perfectly for the default template. This is what I'm using:

db.getSiblingDB('%%database%%').%%collection%%.find({$1})
Thanks again!

Leave a Comment
 
Attach a file