meteor-find-and-modify icon indicating copy to clipboard operation
meteor-find-and-modify copied to clipboard

Support Mongo.ObjectID

Open fongandrew opened this issue 10 years ago • 2 comments

Meteor supports using Mongo's internal ObjectID in lieu of a string when the right idGeneration option is passed (http://docs.meteor.com/#/full/mongo_collection). We should build in some support for that option into findAndModify.

fongandrew avatar Nov 02 '15 17:11 fongandrew

+1 for this issue.

I've tried to resolve myself but do not have a good enough understanding on how to query Mongo.ObjectIDs within the underlying Mongo connection. Using Mongo.ObjectID within the query does not provide any results.

If you can assist by providing an example of how to query based on a Mongo.Object ID within Meteor I'll happily test and create the pull request.

obezuk avatar Aug 30 '16 03:08 obezuk

I'm not sure, but I think you can just do something like {_id: new Mongo.ObjectID("<yourHexString>")} to insert and query? See http://docs.meteor.com/api/collections.html#Mongo-ObjectID.

fongandrew avatar Aug 30 '16 03:08 fongandrew