Is there any workaround to the Mongo _id field type limitation?


#1

I am using Meteor with a pre-existing database which uses custom objects in the _id field. I have defined the structure with Meteor like this:

_id: {
type: Object,
label: “ID”
},

“_id.templateId” : {
type: String,
label: “Template ID”,
optional: false
},

“_id.locale”: {
type: String,
optional: false
},

However, when I try to use the collection, I get an error stating that “Meteor does not currently support objects other than ObjectID as ids.”

Is there a workaround which would allow me to use this collection in Meteor without having to change the existing database?


#2

Sounds like example use for good old Cursor.observe and low level publish API :smiley:


#3

Hello shock, could you explain comome do to fix it? :slight_smile: I’m new on Meteor framework!
Thank You!


#4

#5

I don’t think that is going to help… He is trying to use an Object inside _id filed of a document, which Meteors Mongo driver doesn’t support currently!

I think you’ll have to change your document structure…


#6

So I can not do anything? :frowning:


#7

if you just wanna play around with the data then you could write a node.js script to migrate the collection(s) and omit the _id