Hi, I’ve got a problem with cbimport from Couchbase 7.1 version on Mac. My colleague uses 6.5.0 version on Windows import with the same options works fine for him. The problematic part is: entity::%_id.$oid%
For some reason it doesn’t work for me. The error is:
ERRO: Failed to import document 10632: key generation for document failed, resulting field is a JSON array/object -- jsondata.(*Source).handleError() at source.go:425
cbimport request:
/Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin/cbimport json -u Administrator -p Administrator -b bucket -d file://entity.json --scope-collection-exp _default.entity_temp --generate-key entity::%_id.$oid% -f list -c http://0.0.0.0:8091
Source json:
{
"_id": {
"$oid": "11111"
},...
}
@maksymfedosov I’m not an expert in this area but from the documentation it sounds like the % delimiter syntax should be
%_id%.%$oid%
instead of
%_id.$oid%
Also, the Linux shell might be trying to interpret $oid as an environment variable reference on a Mac, whereas on Windows environment variables are themselves referenced as %var% – so many complications here! So maybe you need to \ escape the $, like
%_id%.%\$oid%
This just has the feel of the shell meddling with interpretation of all the weirdness in this argument.
1 Like
Thank you Kevin, your hint has a right direction. I turned out that for zsh on Mac we should use %% instead of %, so it works this way: %%_id.$oid%%
Thank you for help)
@maksymfedosov Glad my guesses were close enough to the ballpark for you to find the correct fix.
1 Like