/node_modules/mongodb/node_modules/bson/lib/bson/db_ref.js
https://bitbucket.org/gagginaspinnata/todo-app-with-angularjs · JavaScript · 33 lines · 17 code · 3 blank · 13 comment · 3 complexity · ae5951f4a59467d96a091e41e342a1de MD5 · raw file
- /**
- * A class representation of the BSON DBRef type.
- *
- * @class Represents the BSON DBRef type.
- * @param {String} namespace the collection name.
- * @param {ObjectID} oid the reference ObjectID.
- * @param {String} [db] optional db name, if omitted the reference is local to the current db.
- * @return {DBRef}
- */
- function DBRef(namespace, oid, db) {
- if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);
-
- this._bsontype = 'DBRef';
- this.namespace = namespace;
- this.oid = oid;
- this.db = db;
- };
- /**
- * @ignore
- * @api private
- */
- DBRef.prototype.toJSON = function() {
- return {
- '$ref':this.namespace,
- '$id':this.oid,
- '$db':this.db == null ? '' : this.db
- };
- }
- if(typeof window === 'undefined') {
- exports.DBRef = DBRef;
- }