transporter icon indicating copy to clipboard operation
transporter copied to clipboard

Running javascript with Mongodb collection_filters

Open ebaizel opened this issue 8 years ago • 2 comments

Within the collection_filters of Mongodb adaptor, is it possible to run javascript? Specifically, we'd like to check for documents with a _id within a certain date range.

For example, from the Mongo shell if we wanted to only get users that had an _id timestamp from before 10/1/2015, we would issue:

db.users.find({_id:{$lt: ObjectId(Math.floor((new Date('2015/10/01'))/1000).toString(16) + "0000000000000000")})

I tried converting this to the collection_filters syntax with this: "{"users": {"_id":{"$lt": ObjectId(Math.floor((new Date('2015/10/01'))/1000).toString(16) + "0000000000000000")}}}"

but got an error complaining about the command_filters being invalid.

would you expect this to work?

ebaizel avatar Mar 27 '17 22:03 ebaizel

that's a pretty complex query and that will definitely not work yet but it's definitely something I think transporter could/should support.

I'm going to tag this as an enhancement and I may be able to get to it soon since I had already planned on converting the collection_filters from a string to a JSON object soon.

jipperinbham avatar Mar 27 '17 22:03 jipperinbham

@jipperinbham is there any plans to add this functionality?

sashaaKr avatar Jul 31 '19 12:07 sashaaKr