I cannot write any data to my MongoDB using R mongolite. I consistently get: Error: not primary
error.
collection <- mongolite::mongo(url=my_url, db=my_db, collection=my_collection)
collection$insert(iris)
Error: not primary
This Error: not primary
message occurs whatever I try to insert.
The database works fine, as I can write to it using Python without any problems.
I would appreciate any help!
- Tried other data frames, JSON objects, lists, ...
- Tried inserting a hand-written JSON string, like this:
collection$insert('{"a": 3}')
- Tried if I could
find
in the same database using mongolite (yes) - Tried if I could write using Python (yes)
- Checked Mongolite documentation and github