-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NO2.11011: error while submitting changes to remote collection #25
Comments
I strongly suggest you consider the reference documentation first - http://www.dizitart.org/nitrite-database/doc/2.0.0/index.html#replication You don't need to manually create the collections in mongo. It will be created by this line from client DataGateSyncTemplate syncTemplate
= new DataGateSyncTemplate(dataGateClient, "remote-collection@userId"); Here "remote-collection@userId" is the collection name that will be created in mongo by datagate. |
I've been throw the documentation many times but nothing. this is my client code. DataGateClient dataGateClient = new DataGateClient("http://localhost:9090")
.withAuth("shadi", "123456")
.withUserAgent(userAgent);
DataGateSyncTemplate syncTemplate
= new DataGateSyncTemplate(dataGateClient, "test-collection@shadi");
NitriteCollection collection = DB.getCollection("test");
SyncHandle syncHandle = Replicator.of(DB)
.forLocal(collection)
// a DataGate sync template implementation
.withSyncTemplate(syncTemplate)
// replication attempt delay of 1 sec
.delay(timeSpan(1, TimeUnit.SECONDS))
// both-way replication
.ofType(ReplicationType.BOTH_WAY)
// sync event listener
.withListener(new SyncEventListener() {
@Override
public void onSyncEvent(SyncEventData eventInfo) {
System.out.println("data is synced" + eventInfo.getError());
}
})
.configure();
syncHandle.startSync();
Document doc = createDocument("firstName", "John")
.put("lastName", "Doe")
.put("birthDay", new Date())
//.put("data", new byte[] {1, 2, 3})
//.put("fruits", new ArrayList<String>() {{ add("apple"); add("orange"); }})
.put("note", "a quick brown fox jump over the lazy dog");
collection.insert(doc);
DB.commit();
DB.close(); my client application is throwing this exception data is syncedorg.dizitart.no2.exceptions.SyncException: NO2.11011: error while submitting changes to remote collection the server is throwing this exception 2017-09-06 13:41:35.735 ERROR 5847 --- [qtp914356853-15] o.d.n.d.advices.DataGateApiErrorHandler : DataGate HTTP Error org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: NO2.3009: document id is an auto generated value and can not be 771985644632835459; nested exception is com.fasterxml.jackson.databind.JsonMappingException: NO2.3009: document id is an auto generated value and can not be 771985644632835459 (through reference chain: org.dizitart.no2.sync.data.ChangeFeed["modifiedDocuments"]->java.util.ArrayList[0]->org.dizitart.no2.Document["_id"]) please if you any idea where would look for a solution |
I'll take a look into it tomorrow. Meantime can you also go through one of the datagate junit tests? That might give you an idea if you are doing anything wrong. Now is the night time for me here, so can't be of immediate help. This is the file you need to look at - https://github.com/dizitart/nitrite-database/blob/master/nitrite-datagate/src/test/java/org/dizitart/no2/datagate/DataGateSyncTest.java |
Sorry for the late reply, I was so caught up with my work. Can you please remove the line - |
I am trying to use nitrite database with a project I am working on and it needs to be connected to the datagate server.
I set up the users and clients when syncing starts it throwing this error.
on the client side
org.dizitart.no2.exceptions.SyncException: NO2.11011: error while submitting changes to remote collection
on the server side
org.dizitart.no2.exceptions.InvalidOperationException: NO2.3009: document id is an auto generated value and can not be 771985705443479845
and I have a question. do I need to create the collection manually on mongo.
Thanks for help
The text was updated successfully, but these errors were encountered: