Closed davisford closed 6 years ago
So, JS has null and undefined.
null
undefined
I am trying to do a projection like the following in mgo:
{ $project: { name { $cond: { if: { $eq: ['$foobar', undefined ] }, then: '$foo', else: { $concat: [ '$foobar.name', '-', '$foo' ] }, } }, }
But I cannot represent undefined in golang / bson.M parlance. The keyword nil does not work.
nil
Any ideas?
Sorry, spoke too soon. I see there is a bson.Undefined constant that can be used.
bson.Undefined
So, JS has
null
andundefined
.I am trying to do a projection like the following in mgo:
But I cannot represent
undefined
in golang / bson.M parlance. The keywordnil
does not work.Any ideas?