Advertisement
Guest User

Untitled

a guest
Nov 30th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 KB | None | 0 0
  1. const User = mongoose.model('User', {name: String, email: String, passwordHash: String, validation: String, validationCode: String, favorites: Array })
  2.  
  3.  
  4. exports.findUser = function findUser(email){
  5.  
  6. const foundUser = User.findOne({email: email}, function(err, userObj){
  7. if(err){
  8. return err
  9. } else if (userObj){
  10. return userObj
  11. } else{
  12. return null
  13. }
  14. })
  15.  
  16. return foundUser
  17. }
  18.  
  19. Query {
  20. _mongooseOptions: {},
  21. mongooseCollection:
  22. NativeCollection {
  23. collection: null,
  24. opts: { bufferCommands: true, capped: false },
  25. name: 'users',
  26. collectionName: 'users',
  27. conn:
  28. NativeConnection {
  29. base: [Object],
  30. collections: [Object],
  31. models: [Object],
  32. config: [Object],
  33. replica: false,
  34. hosts: null,
  35. host: 'ds113938.mlab.com',
  36. port: 13938,
  37. user: 'root',
  38. pass: 'root',
  39. name: 'users',
  40. options: [Object],
  41. otherDbs: [],
  42. _readyState: 2,
  43. _closeCalled: false,
  44. _hasOpened: false,
  45. _listening: false,
  46. db: [Object] },
  47. queue: [],
  48. buffer: true,
  49. emitter:
  50. EventEmitter {
  51. domain: null,
  52. _events: {},
  53. _eventsCount: 0,
  54. _maxListeners: undefined } },
  55. model:
  56. { [Function: model]
  57. hooks: Kareem { _pres: {}, _posts: {} },
  58. base:
  59. Mongoose {
  60. connections: [Object],
  61. plugins: [],
  62. models: [Object],
  63. modelSchemas: [Object],
  64. options: [Object] },
  65. modelName: 'User',
  66. model: [Function: model],
  67. db:
  68. NativeConnection {
  69. base: [Object],
  70. collections: [Object],
  71. models: [Object],
  72. config: [Object],
  73. replica: false,
  74. hosts: null,
  75. host: 'ds113938.mlab.com',
  76. port: 13938,
  77. user: 'root',
  78. pass: 'root',
  79. name: 'users',
  80. options: [Object],
  81. otherDbs: [],
  82. _readyState: 2,
  83. _closeCalled: false,
  84. _hasOpened: false,
  85. _listening: false,
  86. db: [Object] },
  87. discriminators: undefined,
  88. schema:
  89. Schema {
  90. obj: [Object],
  91. paths: [Object],
  92. subpaths: {},
  93. virtuals: [Object],
  94. singleNestedPaths: {},
  95. nested: {},
  96. inherits: {},
  97. callQueue: [Object],
  98. _indexes: [],
  99. methods: {},
  100. statics: {},
  101. tree: [Object],
  102. _requiredpaths: undefined,
  103. discriminatorMapping: undefined,
  104. _indexedpaths: undefined,
  105. query: {},
  106. childSchemas: [],
  107. s: [Object],
  108. options: [Object],
  109. '$globalPluginsApplied': true },
  110. collection:
  111. NativeCollection {
  112. collection: null,
  113. opts: [Object],
  114. name: 'users',
  115. collectionName: 'users',
  116. conn: [Object],
  117. queue: [],
  118. buffer: true,
  119. emitter: [Object] },
  120. Query: { [Function] base: [Object] },
  121. '$__insertMany': [Function],
  122. insertMany: [Function] },
  123. schema:
  124. Schema {
  125. obj:
  126. { name: [Function: String],
  127. email: [Function: String],
  128. passwordHash: [Function: String],
  129. validation: [Function: String],
  130. validationCode: [Function: String],
  131. favorites: [Function: Array] },
  132. paths:
  133. { name: [Object],
  134. email: [Object],
  135. passwordHash: [Object],
  136. validation: [Object],
  137. validationCode: [Object],
  138. favorites: [Object],
  139. _id: [Object],
  140. __v: [Object] },
  141. subpaths: {},
  142. virtuals: { id: [Object] },
  143. singleNestedPaths: {},
  144. nested: {},
  145. inherits: {},
  146. callQueue: [ [Object], [Object], [Object], [Object] ],
  147. _indexes: [],
  148. methods: {},
  149. statics: {},
  150. tree:
  151. { name: [Function: String],
  152. email: [Function: String],
  153. passwordHash: [Function: String],
  154. validation: [Function: String],
  155. validationCode: [Function: String],
  156. favorites: [Function: Array],
  157. _id: [Object],
  158. id: [Object],
  159. __v: [Function: Number] },
  160. _requiredpaths: undefined,
  161. discriminatorMapping: undefined,
  162. _indexedpaths: undefined,
  163. query: {},
  164. childSchemas: [],
  165. s: { hooks: [Object], kareemHooks: [Object] },
  166. options:
  167. { retainKeyOrder: false,
  168. typeKey: 'type',
  169. id: true,
  170. noVirtualId: false,
  171. _id: true,
  172. noId: false,
  173. validateBeforeSave: true,
  174. read: null,
  175. shardKey: null,
  176. autoIndex: null,
  177. minimize: true,
  178. discriminatorKey: '__t',
  179. versionKey: '__v',
  180. capped: false,
  181. bufferCommands: true,
  182. strict: true,
  183. pluralization: true },
  184. '$globalPluginsApplied': true },
  185. op: 'findOne',
  186. options: { retainKeyOrder: false },
  187. _conditions: { email: 'Adam@gmail.com' },
  188. _fields: undefined,
  189. _update: undefined,
  190. _path: undefined,
  191. _distinct: undefined,
  192. _collection:
  193. NodeCollection {
  194. collection:
  195. NativeCollection {
  196. collection: null,
  197. opts: [Object],
  198. name: 'users',
  199. collectionName: 'users',
  200. conn: [Object],
  201. queue: [],
  202. buffer: true,
  203. emitter: [Object] },
  204. collectionName: 'users' },
  205. _traceFunction: undefined,
  206. _castError: null,
  207. _count: [Function],
  208. _execUpdate: [Function],
  209. _find: [Function],
  210. _findOne: [Function],
  211. _findOneAndRemove: [Function],
  212. _findOneAndUpdate: [Function] }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement