Get<dynamic> bug

I have discovered a weird bug when trying to get a document with dynamic datatype

The document is hierarchical and one of the properties has a property version with the same name as the grand

Maybe this is a bug with NewtonSoft or with the SDK

The code is:

var resulta = bucketOld.Get<dynamic>(“acquisition::44444”);

The error is:

Can not add property version to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.

The document is:

{
“acquisitionType”: “acquisition”,
“acquisitionTypeID”: 318261,
“acquisitionVerb”: “will acquire”,
“announceDate”: “2015-01-28T00:00:00”,
“balanceSheet”: {
“currencyID”: 0,
“stakePercentage”: 100
},
“buyerDesciption”: “BATS Global Markets, Inc. is a leading global operator of securities markets, committed to Making Markets Better for traders, investors and issuers. In the U.S., BATS operates four stock exchanges – BZX, BYX, EDGX and EDGA – and regularly ranks as the top market for ETF and retail-driven liquidity.”,
“buyers”: [
{
“id”: 102997489,
“originalName”: “BATS Global Markets, Inc.”,
“shortDescription”: “BATS Global Markets, Inc. is a leading global operator of securities markets, committed to Making Markets Better for traders, investors and issuers. In the U.S., BATS operates four stock exchanges – BZX, BYX, EDGX and EDGA – and regularly ranks as the top market for ETF and retail-driven liquidity.”,
“stakePercentage”: 100,
“ultimateParentID”: 102997489,
“ultimateParentOriginalName”: “BATS Global Markets, Inc.”
}
],
“certainAssets”: “”,
“exchangeTerms”: “N/A”,
“seller”: {
“finance”: {
“confidential”: false,
“currency”: {
“toUSDRate”: 0,
“id”: 1
},
“financialAccuracyID”: {},
“fiscalYearEndMonth”: 0,
“isPublic”: false,
“taxStatusID”: {},
“useNativeValuesToUpdate”: false,
“year”: 0,
“active”: true,
“changeDate”: “2015-01-28T15:47:02.02”,
“changeUserID”: 3374,
“entryDate”: “2015-01-28T15:47:02.02”,
“entryUserID”: 3374,
“id”: 0,
“version”: 0
},
“id”: 102993686,
“originalName”: “KCG Hotspot FX”,
“parentID”: 102989927,
“parentOriginalName”: “KCG Holdings, Inc.”,
“shortDescription”: “Hotspot FX brings the powerful benefits of an independent, transparent ECN marketplace structure to institutional foreign exchange trading. These benefits include full depth-of-book view, centralized price discovery, direct and anonymous market access.”,
“ultimateParentID”: 102989927,
“ultimateParentOriginalName”: “KCG Holdings, Inc.”
},
“status”: “Announced”,
“statusID”: 1,
“active”: true,
“changeUserID”: 0,
“date”: “2015-01-28T00:00:00”,
“description”: “BATS Global Markets (BATS) announced a definitive agreement with KCG Holdings to acquire Hotspot FX, a leading institutional spot foreign exchange market. Hotspot FX brings the powerful benefits of an independent, transparent ECN marketplace structure to institutional foreign exchange trading.”,
“entryUserID”: 0,
“id”: 44444,
“name”: “BATS Global Markets, Inc. will acquire KCG Hotspot FX”,
“objectType”: “acquisition”,
“version”: 0
}

So if I remove the second version under the property seller.finance no error.

The error free document is:

{
“acquisitionType”: “acquisition”,
“acquisitionTypeID”: 318261,
“acquisitionVerb”: “will acquire”,
“announceDate”: “2015-01-28T00:00:00”,
“balanceSheet”: {
“currencyID”: 0,
“stakePercentage”: 100
},
“buyerDesciption”: “BATS Global Markets, Inc. is a leading global operator of securities markets, committed to Making Markets Better for traders, investors and issuers. In the U.S., BATS operates four stock exchanges – BZX, BYX, EDGX and EDGA – and regularly ranks as the top market for ETF and retail-driven liquidity.”,
“buyers”: [
{
“id”: 102997489,
“originalName”: “BATS Global Markets, Inc.”,
“shortDescription”: “BATS Global Markets, Inc. is a leading global operator of securities markets, committed to Making Markets Better for traders, investors and issuers. In the U.S., BATS operates four stock exchanges – BZX, BYX, EDGX and EDGA – and regularly ranks as the top market for ETF and retail-driven liquidity.”,
“stakePercentage”: 100,
“ultimateParentID”: 102997489,
“ultimateParentOriginalName”: “BATS Global Markets, Inc.”
}
],
“certainAssets”: “”,
“exchangeTerms”: “N/A”,
“seller”: {
“finance”: {
“confidential”: false,
“currency”: {
“toUSDRate”: 0,
“id”: 1
},
“financialAccuracyID”: {},
“fiscalYearEndMonth”: 0,
“isPublic”: false,
“taxStatusID”: {},
“useNativeValuesToUpdate”: false,
“year”: 0,
“active”: true,
“changeDate”: “2015-01-28T15:47:02.02”,
“changeUserID”: 3374,
“entryDate”: “2015-01-28T15:47:02.02”,
“entryUserID”: 3374,
“id”: 0
},
“id”: 102993686,
“originalName”: “KCG Hotspot FX”,
“parentID”: 102989927,
“parentOriginalName”: “KCG Holdings, Inc.”,
“shortDescription”: “Hotspot FX brings the powerful benefits of an independent, transparent ECN marketplace structure to institutional foreign exchange trading. These benefits include full depth-of-book view, centralized price discovery, direct and anonymous market access.”,
“ultimateParentID”: 102989927,
“ultimateParentOriginalName”: “KCG Holdings, Inc.”
},
“status”: “Announced”,
“statusID”: 1,
“active”: true,
“changeUserID”: 0,
“date”: “2015-01-28T00:00:00”,
“description”: “BATS Global Markets (BATS) announced a definitive agreement with KCG Holdings to acquire Hotspot FX, a leading institutional spot foreign exchange market. Hotspot FX brings the powerful benefits of an independent, transparent ECN marketplace structure to institutional foreign exchange trading.”,
“entryUserID”: 0,
“id”: 44444,
“name”: “BATS Global Markets, Inc. will acquire KCG Hotspot FX”,
“objectType”: “acquisition”,
“version”: 0
}

@envitraux -

Could you create an example project and attach it to a [Jira ticket][1]?

Thanks!

-Jeff
[1]: https://issues.couchbase.com/browse/NCBC

I did figure it out. It had to do with having two properties on the dynamic object that have the same name with case issues. In this situation,

Version

and

version

The expando object allows this confusion
I did submit the code to Jira, but it more than likely is a problem with expando and Newtonsoft

1 Like