My project requires the collection to have a unique index to prevent duplicates. I'm not finding any docs on this particular use case. Can anyone help? I found some possibly old stuff about a query option called Run JS but that appears to be gone now? Would I somehow use the Raw option to perform the createIndex operation? I cannot find examples of this.
#Mongo how to createIndex
1 messages · Page 1 of 1 (latest)
Hey There,
We've registered your query, and our team will get back to you soon.
Regards,
Pranav
Hello, could you please explain your use case in a bit more detail and share
some screenshots of your current configuration, as well as those documents you
mentioned?
I want to use createIndex to prevent duplicates. Simple as that. It's a very common Mongo method.
This is usually a one-time modification made to the database itself. In this
case, you will want to perform this operation from your MongoDB shell following
these docs:
https://www.mongodb.com/docs/manual/indexes/#create-an-index
Hmm, that means I would need to set up the collection ahead of time as well, which Mongo supports created the collection if it's missing. This really should be part of appsmith.
Or at least expose access to the DB via JSObjects. Then it'd be quite easy to do.
This missing from AppSmith means I have to get DevOps involved. 👎