}
+void EJDB_remove(VALUE self, VALUE collName, VALUE rboid) {
+ SafeStringValue(collName);
+ SafeStringValue(rboid);
+
+ EJDB* ejdb = getEJDB(self);
+
+ EJCOLL *coll = ejdbgetcoll(ejdb, StringValuePtr(collName));
+ if (!coll) {
+ raise_ejdb_error(ejdb);
+ }
+
+ bson_oid_t oid = ruby_to_bson_oid(rboid);
+ if (!ejdbrmbson(coll, &oid)) {
+ raise_ejdb_error(ejdb);
+ }
+}
+
+
void EJDB_set_index_internal(VALUE self, VALUE collName, VALUE fpath, int flags) {
SafeStringValue(collName);
SafeStringValue(fpath);
rb_define_method(ejdbClass, "find", RUBY_METHOD_FUNC(EJDB_find), -1);
rb_define_method(ejdbClass, "find_one", RUBY_METHOD_FUNC(EJDB_find_one), -1);
rb_define_method(ejdbClass, "update", RUBY_METHOD_FUNC(EJDB_update), -1);
+ rb_define_method(ejdbClass, "remove", RUBY_METHOD_FUNC(EJDB_remove), 2);
rb_define_method(ejdbClass, "drop_collection", RUBY_METHOD_FUNC(EJDB_drop_collection), 2);
rb_define_method(ejdbClass, "ensure_collection", RUBY_METHOD_FUNC(EJDB_ensure_collection), -1);
puts "test_ejdba_id_nin has passed successfull"
end
+ def test_ejdbb_test_remove
+ assert_not_nil $jb
+ assert $jb.is_open?
+
+ obj = $jb.find_one("birds", {"name" => "Molly"})
+ assert_not_nil obj
+ assert_not_nil obj["_id"]
+ assert_equal("Very angry", obj["mood"])
+
+ #Bye bye Molly!
+ $jb.remove("birds", obj["_id"])
+
+ obj = $jb.find_one("birds", {"name" => "Molly"})
+ assert_nil obj
+
+ puts "test_ejdbb_test_remove has passed successfull"
+ end
+
end