How can I create unique IDs for embedded documents in MongoDB?

前端 未结 6 542
北海茫月
北海茫月 2021-01-30 13:37

So I need to reference particular subdocuments uniquely from items in my collection. For instance:

User = {
    \'name\': \'jim\',
    \'documents: [
        {\         


        
6条回答
  •  无人及你
    2021-01-30 14:09

    In Meteor, on the server, use:

    new Meteor.Collection.ObjectID(hexString);
    

    See: http://docs.meteor.com/#collection_object_id

提交回复
热议问题