Inser document with own id?

I’m having a client side collection and trying to insert a document with an own _id field, but it isn’t working.


This doesn’t work. The document was added with a different _id.

When you say a “client side collection”, do you mean a local (unmanaged) collection? If so it should work:

Maybe the record is being added properly but you’re accidentally retrieving a different record?

Mh, strange. I’m trying to clone objects from one collection to another with this code:

        added: function(id, doc) {

            if(!MessagesClient.findOne({_id:id})) {

                //New one

                var message = Messages.findOne(id);

                message.decrypt((val) => {

                    doc.text = val;


        changed: function(newDoc,oldDoc) {


Messages is defined on client and server, while MessageClient is client only (null name). All documents in MessageClient have different id’s than their originals.

Just though I’ve checked that, but I have to add ._id to the doc:

 doc.text = val;
 doc._id = id;