我似乎无法从C驱动程序找到有关mongodb身份验证的文档。据我所知,C驱动程序API没有关于它的信息。然而,this link让我觉得这是可能的。链接或代码片段会很棒。谢谢!mongodb C驱动程序认证
1
A
回答
2
这里是调用的函数。
MONGO_EXPORT int mongo_cmd_authenticate (
mongo * conn,
const char * db,
const char * user,
const char * pass
)
Authenticate a user.
Parameters:
conn a mongo object.
db the database to authenticate against.
user the user name to authenticate.
pass the user's password.
Returns:
MONGO_OK on sucess and MONGO_ERROR on failure.
下面是测试代码的摘录为例 - 蒙戈-C驱动器/测试/ auth_test.c
if (mongo_connect(conn , TEST_SERVER, 27017)) {
printf("failed to connect\n");
exit(1);
}
ASSERT(mongo_cmd_authenticate(conn, db, "user", "password") == MONGO_OK);
...
希望这有助于。以下是一些有关进一步信息的链接。
参考文献:
MongoDB的C语言的中心 - http://www.mongodb.org/display/DOCS/C+Language+Center
MongoDB的C驱动文档 - http://api.mongodb.org/c/current/
MongoDB的C驱动API文档 - http://api.mongodb.org/c/current/api/index.html
mongo.h文件和借鉴 - http://api.mongodb.org/c/current/api/mongo_8h.html
mongo_cmd_authenticate - http://api.mongodb.org/c/current/api/mongo_8h.html#a715aaa6b82e23486e6caad2b544f2ebf
MongoDB的C驱动源代码 - https://github.com/mongodb/mongo-c-driver
测试/ auth_test.c - https://github.com/mongodb/mongo-c-driver/blob/master/test/auth_test.c
相关问题
- 1. mongodb C++驱动程序验证
- 2. C#MongoDB驱动程序OutOfMemoryException
- 3. MongoDB C驱动程序
- 4. MongoDB的C#驱动程序“的远程证书无效”
- 5. Mongodb C#驱动程序与ignoreNull和忽略布尔默认值
- 6. MongoDB C#驱动程序投影$ elemMatch $
- 7. Mongodb C++驱动程序和GridFS支持
- 8. MongoDB的C#驱动程序和ISODate
- 9. MongoDB C#驱动程序MongoCredential对象
- 10. MongoDB C++驱动程序中的Upate DB
- 11. MongoDB C#使用新的驱动程序
- 12. MongoDB的C++驱动程序安装
- 13. MongoDB C#驱动程序安全
- 14. c#mongodb驱动程序写关注
- 15. 有GridFS的C#MongoDB驱动程序
- 16. MongoDB查询C#驱动程序
- 17. 无法链接MongoDB C驱动程序?
- 18. MongoDB的C#2.0驱动程序SetSerializationOptions
- 19. MongoDB:哪个C驱动程序?
- 20. mongoDb C++驱动程序忽略mongoclient库
- 21. Libbson和MongoDB-C驱动程序编译
- 22. Windows上的驱动程序认证
- 23. MongoDBb C#驱动程序等效于MongoDb C++驱动程序中的getFieldDotted?
- 24. Java驱动程序MongoDB updateone
- 25. findOne NodeJS MongoDB驱动程序
- 26. MongoDB WriteConcern Java驱动程序
- 27. MongoDB的Java驱动程序
- 28. Mongodb C#驱动程序 - 边界框查询(潜在的驱动程序错误?)
- 29. 与Mongodb c#驱动程序聚合2.4驱动程序不工作
- 30. MongoDB的C#驱动