Hello,
I’m having trouble trying to store and retrieve documents containing ` (backtick) characters in document’s property names.
Following test is “successful”:
Test
@Test
public void backtickTest()
{
final String docId = UUID.randomUUID().toString();
final JsonObject storedContent = JsonObject.from(ImmutableMap.of("prop`", 5));
bucket.upsert(JsonDocument.create(docId, storedContent));
final JsonDocument document = bucket.get(docId);
assertThat(document.content()).isEqualTo(storedContent);
final DocumentFragment<Lookup> lookupResult = bucket.lookupIn(docId).get("prop``").execute();
assertThat(lookupResult.content(0)).isEqualTo(5); // <- FAILS on 5th run
}
Although it’s successful, it can be run only 4 times, on 5th try lookup result is null with status SUBDOC_PATH_NOT_FOUND. Starts working again after couchbase restart. Behavior is repeatable, each time after restart we can run 4 lookups, 5th and so on fails. For properties without backticks everything works like a charm at any point.
Following fails each time:
Failing test
@Test
public void repeatedLookupBacktickTest()
{
final String docId = UUID.randomUUID().toString();
final JsonObject storedContent = JsonObject.from(ImmutableMap.of("prop`", 5));
bucket.upsert(JsonDocument.create(docId, storedContent));
DocumentFragment<Lookup> lookupResult = bucket.lookupIn(docId).get("prop``").execute();
assertThat(lookupResult.content(0)).isEqualTo(5);
lookupResult = bucket.lookupIn(docId).get("prop``").execute();
assertThat(lookupResult.content(0)).isEqualTo(5); // <- FAILS
}
Second lookup always return null with status SUBDOC_PATH_NOT_FOUND.
When document is inserted using subdoc api, lookup also always fails:
Failing test (subdoc insert)
@Test
public void subdocUpsertBacktickTest()
{
final String docId = UUID.randomUUID().toString();
final JsonObject storedContent = JsonObject.from(ImmutableMap.of("prop`", 5));
bucket.mutateIn(docId).upsertDocument(true)
.upsert("prop``", 5).execute();
final JsonDocument document = bucket.get(docId);
assertThat(document.content()).isEqualTo(storedContent);
final DocumentFragment<Lookup> lookupResult = bucket.lookupIn(docId).get("prop``").execute();
assertThat(lookupResult.content(0)).isEqualTo(5); // <- FAILS
}
As before, lookup result is null with status SUBDOC_PATH_NOT_FOUND.
Everything above was tested against couchbase 5.0.1 and 5.1.1 (docker containers), using both sync and async apis. Client used was Java 2.5.4, however all issues are reproductible using python client, so the problem seems not to be client-related.
Did anyone encounter similar issues? Is there any workaround?
Regards,
Krzysztof