Announcement Announcement Module
Collapse
No announcement yet.
Spring Data MongoDB GridFS Batch Delete Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data MongoDB GridFS Batch Delete

    I'm currently using MongoDB GridFS with Spring Data to store a set of files along with the file's associated metadata (name and version).

    I would like to run a bulk delete operation on a list of these files that have been selected by the user in the UI so I need to dynamically build a query that looks like the following:

    {code}
    {
    $and: [{
    "contentType": "application/vnd.sometype"
    },
    {
    $or: [{
    "metadata.name": "someName",
    "metadata.version": "someVersion"
    },
    {
    "metadata.name": "someOtherName",
    "metadata.version": "someOtherVersion"
    }]
    }]
    },
    Fields: null,
    Sort: null
    {code}

    The $or clause has an entry for each file to delete. Using BasicQuery I was able to write a raw query using a StringBuilder; however, I wasn't able to write the query using the Query / Criteria api... is there a way to achieve this query with the Criteria API?

    Thanks in advance.

  • #2
    Please, move your question to the StackOverflow - we are going to close this forum soon and rely on SO.
    We need to clean this forum (old unanswered question) before close it.

    Thanks for understanding

    Comment

    Working...
    X