base_command.js 769 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. Base object used for common functionality
  3. **/
  4. var BaseCommand = exports.BaseCommand = function BaseCommand() {
  5. };
  6. var id = 1;
  7. BaseCommand.prototype.getRequestId = function getRequestId() {
  8. if (!this.requestId) this.requestId = id++;
  9. return this.requestId;
  10. };
  11. BaseCommand.prototype.setMongosReadPreference = function setMongosReadPreference(readPreference, tags) {}
  12. BaseCommand.prototype.updateRequestId = function() {
  13. this.requestId = id++;
  14. return this.requestId;
  15. };
  16. // OpCodes
  17. BaseCommand.OP_REPLY = 1;
  18. BaseCommand.OP_MSG = 1000;
  19. BaseCommand.OP_UPDATE = 2001;
  20. BaseCommand.OP_INSERT = 2002;
  21. BaseCommand.OP_GET_BY_OID = 2003;
  22. BaseCommand.OP_QUERY = 2004;
  23. BaseCommand.OP_GET_MORE = 2005;
  24. BaseCommand.OP_DELETE = 2006;
  25. BaseCommand.OP_KILL_CURSORS = 2007;