mongoDBRefNew

Creates a MongoDB DBRef, a reference from one document to a document in another collection, identified by that collection's name and the referenced document's _id.

mongoDBRefNew(collectionName, objectId [, db]) → returns any

This function requires Adobe ColdFusion 2021 and up.  Not supported on Lucee, etc.

Argument Reference

collectionName string
Required

Name of the collection that holds the referenced document.

objectId any
Required

The _id of the referenced document, for example an ObjectId created with mongoObjectIdNew.

db string

Name of the database that holds the referenced collection.

Compatibility

ColdFusion:

Version 2021+ Requires the mongodb package

Examples
Sample code invoking the mongoDBRefNew function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub