removing rows doesnt work

30 views
Skip to first unread message

paweł kamiński

unread,
Jul 27, 2014, 3:17:16 PM7/27/14
to mongo-jack...@googlegroups.com
I have simple functionality where I fetch N items from collection and after I process them I can remove those items from db.

I set JacksonDBCollection to use String as key type and I am extending Storable for all storable domain objects

public abstract class Storable
{
   
@Id
   
private String id;

   
public String getId()
   
{
       
return id;
   
}

   
public void setId(String id)
   
{
       
this.id = id;
   
}
}

in my dao I tried to implement removing like this


public void removeStatuses(List<String> ids)
{
   
// JacksonDBCollection<T, String>
   getCollection
().remove(DBQuery.in("_id", ids), WriteConcern.JOURNALED);
}

but this didnt work. I tried to replace _id with id (as in Storable class)

public void removeStatuses(List<String> ids)
{
   
// JacksonDBCollection<T, String>
   getCollection
().remove(DBQuery.in("id", ids), WriteConcern.JOURNALED);
}

finally I implemented removing like this (which is native mongo api)


public void removeStatuses(List<String> ids)
{
   
final BasicDBList value = new BasicDBList();
   
for (String id : ids)
   
{
        value
.add(new ObjectId(id));
   
}
   
final BasicDBObject q = new BasicDBObject("_id", new BasicDBObject("$in", value));
    getCollection
().getDbCollection().remove(q, WriteConcern.JOURNALED);
}

what I am doing wrong :/ I am using mongo-jack 2.0.0

thanks

Luke Palmer

unread,
Jul 27, 2014, 4:23:12 PM7/27/14
to mongo-jack...@googlegroups.com

There are several open issues that are some variation of this same problem,
which is that there are issues serializing _id particularly with
polymorphic objects.

Concise repro here:

https://github.com/devbliss/mongojack/pull/57

This shouldn't be too hard to fix, but I am hesitant to sink time into it
as at present there are no project admins who are able to look at and merge
pull requests.

--
You received this message because you are subscribed to the Google Groups "mongo-jackson-mapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongo-jackson-ma...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mkr...@trialfire.com

unread,
Jan 12, 2015, 12:56:48 PM1/12/15
to mongo-jack...@googlegroups.com
"at present there are no project admins who are able to look at and merge
pull requests."

Which is really a bummer because Mongojack is a such a useful tool. There's been active contribution to the project but releases are so few and far between that it becomes demotivating for people willing to submit PRs

To unsubscribe from this group and stop receiving emails from it, send an email to mongo-jackson-mapper+unsub...@googlegroups.com.

Shervin Asgari

unread,
Jan 13, 2015, 2:11:08 AM1/13/15
to mongo-jack...@googlegroups.com
Indeed. That is a killer.
The project should really just be moved and maintained by someone else under a different name.

Shervin
Reply all
Reply to author
Forward
0 new messages