We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In according with https://docs.mongodb.com/v3.2/reference/database-references/ I've try to do that:
db.collection("users").findOne({"username": "test"}, function(err, user){ if(err) console.error(err); db.collection("test").save({ "prop1": "val1", "prop2": "val2", "prop3": "val3", "user": { "$ref" : "users", "$id" : user._id} //using mongodb syntax }, function(err, data){ if(err) console.error(err); console.log(data); db.collection("test").find({}).toArray(function(err, results){ if(err) console.error(err); console.log(results); }) }) })
but I received an error: key $ref must not start with '$'. If I try to using the native class DBRef() used in nodejs connector:
db.collection("users").findOne({"username": "test"}, function(err, user){ if(err) console.error(err); db.collection("test").save({ "prop1": "val1", "prop2": "val2", "prop3": "val3", "user": new DBRef("users", user._id) //using DBRef class }, function(err, data){ if(err) console.error(err); console.log(data); db.collection("test").find({}).toArray(function(err, results){ if(err) console.error(err); console.log(results); }) }) })
I receiving an other error: ReferenceError: DBRef is not defined
I'm doing somethings wrong?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In according with https://docs.mongodb.com/v3.2/reference/database-references/ I've try to do that:
but I received an error: key $ref must not start with '$'.
If I try to using the native class DBRef() used in nodejs connector:
I receiving an other error: ReferenceError: DBRef is not defined
I'm doing somethings wrong?
The text was updated successfully, but these errors were encountered: