Yesterday I updated my meteorite and tried to use a new one Meteor.Collection.ObjectID. But so without success. First, I updated my collections in this way:
myCollection = new Meteor.Collection('mycollection', {idGeneration: 'MONGO'}
Now normal new inserts have _idlike Wi2RmR6CSapkmmdfn... (?)
Then I have a collection with the array turned on. I like to have a unique identifier for each object in this array. So, I am $pushan object with a field similar id: new Meteor.Collection.ObjectID()to my array. Result in the database as follows: ObjectId("5b5fc278305d406cc6c33756"). (This seems normal.)
But later, I want to update my pushed object if it idis equal to the id that I previously saved as a data attribute in the html tag.
var equals = EJSON.equals(dbId, htmlId);(This is the result each time false. So I registered values dbIdand htmlIdthe console via console.log(typeof dbId, dbId);)
The values of these two variables are as follows:
object { _str: 'a86ce44f9a46b99bca1be7a9' } (dbId)
string ObjectID("a86ce44f9a46b99bca1be7a9") (htmlId; this seems correct, but why a custom string type?)
How to use Meteor.Collection.ObjectID?
source
share